Question PRG-C-0001
EasyWhat is the output of this program?
#include <stdio.h>
int main() {
int a[] = {10, 20, 30, 40};
int *p = a;
printf("%d", *(p + 2));
return 0;
}
- A.
10
- B.
20
- C.
Show answer and explanation
Answer: C
p points to a[0]. p + 2 points to a[2], and dereferencing it gives 30.