Determine Output:
void main()
{
char far *farther, *farthest;
printf("%d..%d", sizeof(farther), sizeof(farthest));
}
void main()
{
char far *farther, *farthest;
printf("%d..%d", sizeof(farther), sizeof(farthest));
}
A. 4..2
B. 2..2
C. 4..4
D. 2..4
Answer: Option A
Solution(By Examveda Team)
The second pointer is of char type and is not a far pointer.
Join The Discussion
Comments ( 3 )
Related Questions on C Miscellaneous
Determine output:
void main()
{
int const *p=5;
printf("%d", ++(*p));
}
A. 6
B. 5
C. Garbage Value
D. Compiler Error
A. mmm nnn aaa
B. mmmm nnnn aaaa
C. Compiler Error
D. None of These
A. I hate Examveda
B. I love Examveda
C. Error
D. None of These
Determine Output:
void main()
{
static int var = 5;
printf("%d ", var--);
if(var)
main();
}
A. 5 5 5 5 5
B. 5 4 3 2 1
C. Infinite Loop
D. None of These
wrong answer. please check again.
I did not get this concept
Some explanation first:
far pointers are outdated concepts from C, and are actually
compiler extentions, so you might get compiler errors trying
to use far pointers on some compilers.
In the program above,
farther's type - FAR pointer to char
farthest's type - near pointer to char
now, the difference in size of those stems from the fact
that far pointers consist of the segment and offset
together, while near pointers just have the offset.
Near pointers thus have size of 2 (just the offset), while
far pointers - size of 4 bytes.