Advertisement
Guest User

Puntatori & Vettori

a guest
Apr 27th, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1. #include <iostream>
  2.  
  3.  
  4. #include <stdio.h> /* printf, NULL */
  5. #include <stdlib.h> /* srand, rand */
  6. #include <time.h> /* time */
  7. #include <iostream>
  8. #include <string>
  9. #include <stdio.h> /* printf, NULL */
  10. #include <stdlib.h> /* srand, rand */
  11. #include <time.h>
  12.  
  13. int main()
  14. {
  15. int myarray[20];
  16. int mario = 5;
  17. int * mypointer;
  18. int *p2;
  19.  
  20. int martino = 7;
  21.  
  22. p2= &martino;
  23.  
  24. mypointer=myarray;
  25.  
  26. std::cout<<*mypointer<<" valore a cui punta my pointer!\n";
  27. std::cout<<&mypointer<<"indirizzo di my pointer!\n";
  28.  
  29. std::cout<<myarray<<" indirizzo di my array!\n";
  30. std::cout<<&myarray<<" indirizo di my array!\n";
  31. std::cout<<mypointer<<" valore di my ponter!\n";
  32.  
  33.  
  34. mario = *p2;
  35.  
  36. std::cout<<mario<<" valore di my mario!\n";
  37. std::cout<<&mario<<" indirizzo di mario!\n";
  38. std::cout<<p2<<" valore di mypointer !\n";
  39.  
  40. //std::cout<<myarray[0]<<" indirizzo my array!\n";
  41.  
  42.  
  43.  
  44. return 0;
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement