Advertisement
irmantas_radavicius

Untitled

Mar 19th, 2024
306
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.82 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. #include <sstream>
  4. #include <vector>
  5.  
  6. using namespace std;
  7.  
  8. void f(int x[]){
  9.     cout << &x[0] << " " << x[0] << endl;
  10.     //cout << (x+4) << " " << *(x+4) << endl;
  11.     //cout << x << " " << x[0] << endl;
  12. }
  13. int g(int a){
  14.     cout << &a << " " << a << endl;
  15. }
  16. int h(vector<int> b){
  17.     cout << &b << " " << b[0] << endl;
  18. }
  19.  
  20.  
  21. int main(){
  22.     int z = 1;
  23.     cout << &z << " " << z << endl;
  24.     g(z);
  25.     cout << endl << endl;
  26.  
  27.     vector<int> v(10, 5);
  28.     cout << &v << " " << v[0] << endl;
  29.     h(v);
  30.     cout << endl << endl;
  31.  
  32.     int a[10] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
  33.     cout << &a[0] << " " << a[0] << endl;
  34.     for(int i = -5; i < 15; ++i){
  35.         //cout << &a[i] << " " << a[i] << endl;
  36.     }
  37.     //cout << endl;
  38.     f(a);
  39.  
  40.  
  41.     return 0;
  42. }
  43.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement