C Programming - Complicated Declarations - Discussion
Discussion Forum : Complicated Declarations - Find Output of Program (Q.No. 3)
3.
What will be the output of the program?
#include<stdio.h>
int main()
{
char huge *near *far *ptr1;
char near *far *huge *ptr2;
char far *huge *near *ptr3;
printf("%d, %d, %d\n", sizeof(**ptr1), sizeof(ptr2), sizeof(*ptr3));
return 0;
}
Discussion:
31 comments Page 2 of 4.
Meerb said:
1 decade ago
Please me the answer of this question please.
What will be the size of a pointer, pointing to an object of size 1MB?
What will be the size of a pointer, pointing to an object of size 1MB?
Purnima prasad said:
1 decade ago
char huge*near*far*ptr1;
here *ptr1 is near pointer
**ptr1 is huge pointer
and then output will be justified.
here *ptr1 is near pointer
**ptr1 is huge pointer
and then output will be justified.
Sowmya said:
1 decade ago
http://clanguagestuff.blogspot.com/2011/03/difference-between-far-and-huge.html
Its a real good reference.
Its a real good reference.
Praveen said:
1 decade ago
size of near pointer is 2 bytes;
sizeof huge pointer is 4 bytes;
sizeof far pointer is 4 bytes;
sizeof huge pointer is 4 bytes;
sizeof far pointer is 4 bytes;
Arun said:
2 decades ago
Confused about these near, far, huge pointers.
Can anyonre explain this concept?.
Can anyonre explain this concept?.
Satish birajdar said:
1 decade ago
far pointer refers to other code segment
near pointer refers to same code segment
near pointer refers to same code segment
Riya said:
10 years ago
If near pointer is 2 byte then why the output is 4 byte for ptr 2.
Bharath said:
1 decade ago
Please any one explain about this problem I did't get properly.
Monika said:
9 years ago
The %d is used for integers so it will show the size of int.
Goaku said:
1 decade ago
Can we leave such blank spaces while declearing variables?
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers