I started to read a few articles about pointers in C and I've got one example that I don't understand. What should be the output of following code..??
main()
{
char far *s1 ,*s2;
printf("%d,%d",sizeof(s1),sizeof(s2));
}
OUTPUT-4,2
According to me, value returned by both sizeof() functions should be 4 because a far pointer has 4 byte address.
but the answer in solution manual is 4,2. Can any one explain ?? can anyone plz explain>???
It's the same as writing
far makes no sense on a normal character ch.
Hence s2 is not a "far" pointer, and is handled as a "near" pointer, which is 16 bits wide in your target.