fellipeh

Untitled

Aug 17th, 2020
1,951
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.25 KB | None | 0 0
  1. /******************************************************************************
  2.  
  3. Welcome to GDB Online.
  4. GDB online is an online compiler and debugger tool for C, C++, Python, Java, PHP, Ruby, Perl,
  5. C#, VB, Swift, Pascal, Fortran, Haskell, Objective-C, Assembly, HTML, CSS, JS, SQLite, Prolog.
  6. Code, Compile, Run and Debug online from anywhere in world.
  7.  
  8. *******************************************************************************/
  9. #include <iostream>
  10.  
  11. using namespace std;
  12.  
  13. // void reajusta20(float& p, float& r) {
  14. //     r = p * 0.2;
  15. //     p *= 1.2;
  16. //     cout << "\n End. Mem. P: " << &p;
  17. // }
  18.  
  19. void reajusta20(float *p, float *r) {
  20.     *r = *p * 0.2;
  21.     *p *= 1.2;
  22.     cout << "\n End. Mem. P: " << &p;
  23. }
  24.  
  25. int main()
  26. {
  27.     // float preco = 0, val_reaj = 0;
  28.     // cout << "\nDigite o preco: ";
  29.     // cin >> preco;
  30.     // cout << "\n End. Mem. Preco: " << &preco;
  31.     // reajusta20(&preco, &val_reaj);
  32.     // cout << "\nNovo Preco: " << preco << "   Valor Reaj.: " << val_reaj;
  33.    
  34.     int a = 10;
  35.     int *b;
  36.    
  37.     b = &a;
  38.    
  39.     cout << "\n" << a;
  40.     cout << "\n" << &a;
  41.  
  42.     cout << "\n\n" << &b;
  43.     cout << "\n" << *b;
  44.  
  45.     *b = 15;
  46.    
  47.     cout << "\n\n" << *b;
  48.     cout << "\n" << a;
  49.    
  50.     return 0;
  51. }
  52.  
Advertisement
Add Comment
Please, Sign In to add comment