Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- using namespace std;
- void test()
- {
- int f=23;
- float c=435.5;
- double e=3.01;
- int a[2][3]={
- {1,2,3},
- {1,2,3}
- }, row=2,col=3;
- char *s="Hello";
- bool boo=false;
- cout<<"Using a[i][j]"<<endl;
- for(int i=0;i<row;++i)
- {
- for(int j=0;j<col;++j)
- cout<<"Val: "<<a[i][j]<<" Add: "<<&a[i][j]<<" "; //Print the address of each element in array
- cout<<endl;
- }
- cout<<endl;
- cout<<"Using a[0][i]"<<endl;
- for(i=0;i<row*col;++i)
- {
- cout<<"Val: "<<a[0][i]<<" Add: "<<&a[0][i]<<" "; //How can it be ?
- if((i+1)%col==0) cout<<endl;
- }
- }
- int main()
- {
- test();
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement