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 5 of 6.
Emanuel said:
9 years ago
I think it should be q=arr;.
Azagumozhi.M said:
9 years ago
@Teklit. Clear explanation.
Rashmu Jho said:
9 years ago
Nice explanation @Rahul.
Mohana said:
6 years ago
Thank you @Rahul Sharma.
Sakshi munya said:
6 years ago
Thank you @Rahul Sharma.
Chandan said:
7 years ago
Good explanation @Rahul.
Nancy said:
1 decade ago
Good explanation rahul.
Cool said:
1 decade ago
Good one dude! (rahul).
(1)
Priya said:
4 years ago
Thanks@ Rahul Sharma.
Arvind said:
1 decade ago
Nice explaind rahul.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers