ProgrammingModerate
int a[2][3]; What is sizeof(a[1]) on a platform with 4-byte int?
- A. 8
- B. 24
- C. 6
- D. 12
Correct answer: D. 12
a[1] is one row of three ints, so its size is 3 x 4 = 12 bytes. sizeof(a) would be 24.
More C Programming questions
- How many trailing zero bits does 96 have? (96 is 1100000 in binary.)
- What is the index of the highest set bit of 1000 (so 2^index is the largest power of two that is at most 1000)?
- uint16t x = 0x0F00; uint16t y = x & (uint16t)(0u - x); What is y?
- int a[] = {2, 4, 6, 8}; int p = a + 3, q = a; What does printf("%td", p - q) print?
- char names[3][5] = {"ab", "cde", "f"}; What is strlen(names[1]) + sizeof names[2]?
- A recursive function sums decimal digits: int ds(int n) { return n < 10 ? n : n % 10 + ds(n / 10); }. What is ds(98765)?