C Programming - Arrays - Discussion
Discussion Forum : Arrays - Find Output of Program (Q.No. 2)
2.
What will be the output of the program ?
#include<stdio.h>
int main()
{
static int a[2][2] = {1, 2, 3, 4};
int i, j;
static int *p[] = {(int*)a, (int*)a+1, (int*)a+2};
for(i=0; i<2; i++)
{
for(j=0; j<2; j++)
{
printf("%d, %d, %d, %d\n", *(*(p+i)+j), *(*(j+p)+i),
*(*(i+p)+j), *(*(p+j)+i));
}
}
return 0;
}
Discussion:
78 comments Page 7 of 8.
Afreed said:
6 years ago
Nice explanation, thanks @Dilip.
Riya said:
1 decade ago
Please explain clearly why p=0?
Priya said:
10 years ago
Some more clearly please.
(1)
Preethi said:
8 years ago
Nice Explanation @Dilip.
Peter said:
1 decade ago
Can you explain deeply.
Chakri said:
1 decade ago
Please explain clearly.
Maha said:
7 years ago
Thank you for solving.
Kuk said:
7 years ago
Nice, Thanks @Dilip.
Arunsethupathy said:
8 years ago
Thank You @Shweta.
Raadhi said:
7 years ago
Thank you @Dilip.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers