C Programming - Pointers - Discussion
Discussion Forum : Pointers - Find Output of Program (Q.No. 13)
13.
What will be the output of the program?
#include<stdio.h>
int main()
{
int arr[3] = {2, 3, 4};
char *p;
p = arr;
p = (char*)((int*)(p));
printf("%d, ", *p);
p = (int*)(p+1);
printf("%d", *p);
return 0;
}
Discussion:
87 comments Page 8 of 9.
Sayli said:
9 years ago
What is meant by an endian method?
Sachin said:
6 years ago
Can anyone explain this to get it?
Jhunu said:
1 decade ago
Thanks amit. Its cleared my doubt.
Nawaz khan said:
9 years ago
Excellent solution, Thanks @Viraj.
Badareenath said:
2 decades ago
Can anybody explain this please ?
Nahak said:
1 decade ago
Nice one viraj. Really helpful.
Lucky said:
1 decade ago
p = (char*)((int*)(p)); means?
Himanshu batra said:
1 decade ago
Happy Budday viraj. Great job.
Ankita said:
1 decade ago
What is this endian method?
Dilbagh said:
1 decade ago
Viraj you are excellent.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers