ProgrammingHardGATE CS
What is printed? Assume a 4-byte int.
What is printed? Assume a 4-byte int.
int m[3][4];
printf("%zu %zu %zu", sizeof(m[0]), sizeof(*m), sizeof m);- A. 4 4 12
- B. 16 4 48
- C. 16 16 48
- D. 12 16 48
Correct answer: C. 16 16 48
m[0] and *m are both a row of 4 ints (16 bytes); the whole array is 3 rows, 48 bytes.
More C Programming questions
- What is printed? c int a[2][3] = {{1, 2, 3}, {4, 5, 6}}; int p = &a[0][0]; printf("%d %d %d", (p + 4), (a[1] + 2), (a)[2]);
- What is printed? c int i, j; for (i = 0, j = 5; i < j; i++, j--) ; printf("%d %d", i, j);
- What is printed? c int a = 0, b = 0, c; c = (a++ && b++) || (++a || b++); printf("%d %d %d", a, b, c);
- What is printed? c int a = -1; unsigned int b = 1; printf("%d %d", a < b, a < (int)b);
- What is printed? c int f(int n) { return n <= 1 ? 1 : f(n - 1) + f(n - 2) + n; } int main(void) { printf("%d", f(5)); return 0; }
- What is printed? c void g(int a[]) { printf("%d ", (int)(sizeof(a) == sizeof(int ))); } int main(void) { int a[10]; g(a); printf("%zu"…