Pointer - Study Mode
[#111] The statement int ** a
Correct Answer
(C) is syntactically and semantically correct
[#112] What will be the output of the following program? #include<stdio.h>
void main()
{
int i = 10
void *p = &i
printf("%d
", (int)*p)
}
Correct Answer
(A) Compiler time error
Explanation
Solution: p is pointer of type void.
[#113] What will be the output of the following program code? #include<stdio.h>
void main()
{
int i = 10
void *p = &i
printf("%f", *(float *)p)
}
Correct Answer
(C) 0.000000
[#114] The declaration int (* p ) [ 5 ]
means
Correct Answer
(B) p is a pointer to a 5 elements integer array.
[#115] Comment on the following? const int * ptr
Correct Answer
(A) We cannot change the value pointed by ptr .
Explanation
Solution: int * : pointer to int int const * : pointer to const int int * const : const pointer to int int const * const : const pointer to const int Now the first const can be on either side of the type so: const int * == int const * const int * const == int const * const So the above declaration is pointer to const int. Which means, we cannot change the value pointed by ptr .