Question
int main()
{
char *s1;
char far *s2;
printf("%d, %d, %d\n", sizeof(s1), sizeof(s2));
return 0;
}
What is the output of the program in Turbo C (in DOS 16-bit OS)?
int main()
{
char *s1;
char far *s2;
printf("%d, %d, %d\n", sizeof(s1), sizeof(s2));
return 0;
}
Answer: Option A
Was this answer helpful ?
Any pointer size is 2 bytes. (only 16-bit offset)
So, char *s1 = 2 bytes.
So, char far *s2 = 4 bytes.
A far pointer has two parts: a 16-bit segment value and a 16-bit offset value.
Since C is a compiler dependent language, it may give different
output in other platforms. The above program works fine in Windows
(TurboC), but error in Linux (GCC Compiler).
Was this answer helpful ?
More Questions on This Topic :
Question 4.
Which of the following statements should be ....
Submit Solution