C Programming - Pointers - Discussion
Discussion Forum : Pointers - Find Output of Program (Q.No. 12)
12.
What will be the output of the program assuming that the array begins at the location 1002 and size of an integer is 4 bytes?
#include<stdio.h>
int main()
{
int a[3][4] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 };
printf("%u, %u, %u\n", a[0]+1, *(a[0]+1), *(*(a+0)+1));
return 0;
}
Discussion:
61 comments Page 6 of 7.
Triven Sharma said:
1 decade ago
I think *(*(a+0)+1)= *(*(a[0])+1)= *(1+1)=2
as a[0]=1
as a[0]=1
Priya said:
9 years ago
We can write a[i]=i[a]
is it work for a[i][j]=?
is it work for a[i][j]=?
Anjum said:
1 decade ago
Why is the address assumed to be 1002 only?
Soumitra said:
1 decade ago
But how the *(*()) works? please explain.
Gowthami said:
2 decades ago
Please clear information about problem.
Noor said:
1 decade ago
a[0] is similar to *(a+0) which is *a.
Satishp said:
1 decade ago
How (*a[0]+1),*(*(a+0)+1) can be 2?
Anomis said:
7 years ago
Why answer is 1006, 2, 2?
Sakshi munya said:
6 years ago
Thanks @Shahizzz Rulezzz.
Sudhi said:
1 decade ago
I support sharma.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers