#include<stdio.h>
#include<iostream.h>
#include<conio.h>
int main()
{
clrscr();
int A[3][3]={{1,2,3},{4,5,6},{7,8,9}};
int a=5;
int *p; //pointer to int
p=&a;
int **q; //pointer to pointer to int
q=&p;
cout<<A<<endl; //Base Add
cout<<p<<endl;
int (*r)[3];
r=A;
/*cout<<A[0]<<endl; //Base Address
cout<<A+1<<endl;
cout<<A[0]+1<<endl;
cout<<A[0][0]<<endl;
cout<<A[1]<<endl;
cout<<A[1]-A[0]<<endl;
cout<<A[2]<<endl;
*/
cout<<A[0][0]<<endl<<*(*(A+0)+0)<<endl; //*(*(A+i)+j) =A[i][j]
cout<<A[0]<<endl<<*(A+0)<<endl; //*(A+i)=A[i]
cout<<A[1]<<endl<<*(A+1);
int *s;
s=&A[0][0];
getch();
return 0;
}
No comments:
Post a Comment