-
What will be the output of the following C code?
#include <stdio.h>
void main()
{
int arr[5] = {101, 201, 301, 401, 501};
int *q1 = arr;
int *q2 = &q1;
printf("%d", (**q2));
}
-
- Garbage value
- Compilation Error
- 101
- 102
- Same memory address
Correct Option: B
Compilation Error
main.c: In function ‘main’:
main.c:6:19: warning: initialization from incompatible pointer type [-Wincompatible-pointer-types]
int *q2 = &q1;
^
main.c:7:23: error: invalid type argument of unary ‘*’ (have ‘int’)
printf("%d", (**q2));