ProgrammingModerate
int a[2][2] = {1, 2, 3, 4}; What is a[1][0]?
- A. 2
- B. 4
- C. 3
- D. 1
Correct answer: C. 3
A brace list without inner braces fills the array in row-major order: the first row gets 1, 2 and the second row gets 3, 4.
More C Programming questions
- int a[2][3]; What is sizeof(a[1]) on a platform with 4-byte int?
- 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]?