Examveda
Examveda

Determine Output:
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 ( 12 )

  1. CHUNCHE GOWDA
    CHUNCHE GOWDA :
    10 months ago

    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).

  2. Vivek Sharma
    Vivek Sharma :
    1 year ago

    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.

  3. Adam Dont
    Adam Dont :
    1 year ago

    the answer should be 4 4

  4. Asst. Prof.
    Asst. Prof. :
    2 years ago

    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.

  5. Prachi Choudhary
    Prachi Choudhary :
    2 years ago

    Why ans B is right

  6. Swati Varma
    Swati Varma :
    3 years ago

    your solution is wrong

  7. Deepak Kumar
    Deepak Kumar :
    4 years ago

    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

  8. Mukul Aggarwal
    Mukul Aggarwal :
    5 years ago

    pls explain anyone as
    according to me its 2,2

  9. Minakshi Shukla
    Minakshi Shukla :
    5 years ago

    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

  10. Arunkumar C
    Arunkumar C :
    6 years ago

    pls explain detail...
    how pointer size is 2 ?

  11. Manju Kumar
    Manju Kumar :
    6 years ago

    plz detail explanation

  12. Archit Gupta
    Archit Gupta :
    6 years ago

    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.

Related Questions on Pointer