Vidyalelo
C Programming · Q31

Pointer

Programming · C Programming · question 31

Q31

Determine Output: void main() char far *farther, *farthest; printf("%d..%d", sizeof(farther), sizeof(farthest));

A.
4..2
B.
2..2
C.
4..4
Answer
D.
2..4

Answer: Option C

Solution

Answer: Option C
Solution:
In the given C program code snippet:

void main()
{
      char far *farther, *farthest;
      printf("%d..%d", sizeof(farther), sizeof(farthest));
}


The sizeof operator is used to determine the size, in bytes, of a variable or data type.

1. **farther** and **farthest** are both pointers of type **char***. In C, the size of a pointer is typically **4 bytes** on a 32-bit system or **8 bytes** on a 64-bit system. Assuming a standard 32-bit architecture, the size of both pointers would be **4 bytes**. 2. Therefore, the output of the printf function will be: - sizeof(farther) = 4 - sizeof(farthest) = 4

The printf statement prints these two sizes, resulting in the output **"4..4"**.

Hence, the correct answer is **Option C: 4..4**.