Find the output of the following program.
void main()
{
printf("%d, %d", sizeof(int *), sizeof(int **));
}
void main()
{
printf("%d, %d", sizeof(int *), sizeof(int **));
}
A. 2, 0
B. 0, 2
C. 2, 2
D. 2, 4
E. 4, 4
Answer: Option C
Solution(By Examveda Team)
Every pointer regardless of its type whereas single pointer or pointer to pointer, needs only 2 bytes.
Size of pointer and int is 2 bytes in Turbo C compiler on windows 32 bit machine. So size of pointer is compiler specific. But generally most of the compilers are implemented to support 4 byte pointer variable in 32 bit and 8 byte pointer variable in 64 bit machine.
Join The Discussion
Comments ( 1 )
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
its answer is 8 8