View Feed
group-icon
Coffee Room
Discuss anything here - everything that you wish to discuss with fellow engineers.
12933 Members
Join this group to post and comment.
anksingla
anksingla • Oct 3, 2014

problem in c program..

Below program is to print the values of 2d array s.

int s[][2]={12,1,13,214,3};

int i,j;
int (*p)[2];
int *pint;
For(i=0;i<3;++i)
{
p=&s;
pint=(int*)p;
for(j=0;j<2;++j)
printf("%d",*(pint+j));
}
This will print values stored in array .
In the above program in printf statement we use *(pint+j) which prints value.
But if *(*p+j) is use instead of *(pint+j), then also program remains same.
Is this means pint=*p ??
How *(*p+j) works same as *(pint+j)??
Can anyone explain..?

Share this content on your social channels -