ProgrammingHard
int m[2][2] = {{1, 2}, {3, 4}}; int *p = &m[0][0]; printf("%d", p[2] * p[1]); What is printed?
- A. 4
- B. 3
- C. 8
- D. 6
Correct answer: D. 6
p[2] is m[1][0], which is 3, and p[1] is m[0][1], which is 2. Their product is 6.
More C Programming questions
- unsigned char c = 255; c++; printf("%d", c); What is printed?
- int i = 0; printf("%d %d", i++, i); What does this code do?
- const char names[] = {"zero", "one", "two"}; printf("%c", names[2][1]); What is printed?
- int x = 0; for (int i = 0; i < 4; i++) x += i % 2 ? i : -i; printf("%d", x); What is printed?
- int x = 10; int p = &x; p += p 2; printf("%d", x); What is printed?
- int a = 5, b = 2; printf("%d %d", a / b, a % b); What is printed?