C Programming - Pointers - Discussion
Discussion Forum : Pointers - Find Output of Program (Q.No. 11)
11.
What will be the output of the program?
#include<stdio.h>
int main()
{
int arr[2][2][2] = {10, 2, 3, 4, 5, 6, 7, 8};
int *p, *q;
p = &arr[1][1][1];
q = (int*) arr;
printf("%d, %d\n", *p, *q);
return 0;
}
Discussion:
58 comments Page 4 of 6.
Mohana said:
6 years ago
Thank you @Rahul Sharma.
Rashmi said:
5 years ago
Great explanation. Thanks @Rahul Sharma.
Priya said:
4 years ago
Thanks@ Rahul Sharma.
Haneef said:
1 decade ago
Rahul. What the value if its a[ 2 ] [ 1 ] [ 1 ]. ?
Nancy said:
1 decade ago
Good explanation rahul.
Shubham said:
1 decade ago
Please answer me. What significance for sentence below it.
q = (int*) arr;.
q = (int*) arr;.
Sagar Kapadiya (Surat) said:
1 decade ago
Value if its a[ 2 ] [ 2 ] [ 1 ].. ?
VENU said:
1 decade ago
@SAGAR
Its 7.
Its 7.
Swanand said:
1 decade ago
Good rahul hope you explain in future like this.
Kiran sp said:
1 decade ago
Hi friends, can any one tell me, how the elements in 3d array are allocated. ?
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers