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 not a far pointer.
Join The Discussion
Comments ( 14 )
Related Questions on Pointer
In C, what is a pointer primarily used for?
A. Decision making
B. Code organization
C. Variable declaration
D. Storing values
In C, how do you declare a pointer variable that can store the address of an integer?
A. int *ptr;
B. ptr int;
C. int ptr;
D. ptr *int;
What is the purpose of the '->' operator in C when used with pointers?
A. Arithmetic operation
B. Indirection operator
C. Member access operator
D. Bitwise operation
It depends on the compiler.
If you are using a 32-bit system, then it will be 4 bytes, but if you are using a 64-bit system, then it will be 8 bytes.
So the answer should be 4-4, not 4-2.
at any case, size of pointer variable = sizeof(unsigned int). because pointer variable always store address which is nothing but unsigned int.
It depends on compiler that we are using,if our machine is 64bit then pointer is 8byte. if it is 32bit then it is 4 byte.
In this case we are trying to print size of pointer not *ptr(i.e char pointer).
This is a DOS-only program, it won't work in GCC or other modern compilers, far pointers are different types of pointers like near pointer and huge pointer.
the answer should be 4 4
correct answer is 2..2(or 4..4 depending on compiler you are using ). Because you are printing sizeof(farther) and sizeof(farthest), both are char pointers.
Why ans B is right
your solution is wrong
Please explain how ,it is 4,2
If we see the the concept of pointer ,pointer does not depend on datatype ,its depend on system
pls explain anyone as
according to me its 2,2
Acording to me it shoud be 4 4 bcz pointer size is same always and depends upon int size of systm then it is 4 2 what is far plz explain
pls explain detail...
how pointer size is 2 ?
plz detail explanation
the answer should be 4...4 because pointer stores address of a variable which is of integer type and points the value of type of its datatype.