ProgrammingVery hard
Which declaration makes a pointer that walks row by row through an int matrix with 6 columns?
- A. int *row[5];
- B. int **row;
- C. int (*row)[6];
- D. int row[2][6];
Correct answer: C. int (*row)[6];
int (*row)[6] points to a row of six ints. The other forms declare an array of pointers, a pointer to pointer, or an array, which are not row pointers.
More C Programming questions
- For an int matrix a with R rows and C columns stored in row-major order, what is the flat index of the cell at (r, c) in terms of R?
- A matrix of 10 x 10 is searched linearly for a value. About how many cell reads happen in the worst case?
- A 2D array is passed to a function that needs the number of rows. Which argument can it NOT rely on?
- int a[3][3] = {0}; int p = a[1]; p[2] = 7; printf("%d", a[1][2]); What is printed?
- The number of ways to choose a 2 x 2 submatrix in a 4 x 4 matrix (choosing consecutive rows and columns) is what?
- Which of these statements about in-place transposition is correct?