?
Determine Output:
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));
}
Answer & Solution
Correct Answer:
Option
C
In the given C program code snippet:
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**.
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**.
Join the Discussion
Login to post a comment or share your explanation.
Loginchar far,*farther,*farthest;
Is it valid way of declaring?
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.
In this case we are trying to print size of pointer not *ptr(i.e char pointer).
If we see the the concept of pointer ,pointer does not depend on datatype ,its depend on system
according to me its 2,2
how pointer size is 2 ?