int main() {
int **matrix = {
{1, 3, 2, 4},
{3, 2, 4, 5},
{9, 3, 2, 1}
};
getchar();
}
- Why does this display warnings like “braces around scalar initializer”?
- Why do I need to initialize multidimentional arrays with more than one pointers? (if you could give me some pretty easy-to-understand explanation on this one…)
- If I’d want to use int matrix[3][4] instead of int **matrix…what would be a function parameter if I’d want to pass this array?
int[][]?
int **is a pointer type not an array type. Pointers are not arrays. Use typeint [3][4].You cannot pass arrays to functions but you can pass a pointer to an array. A function declaration to pass a pointer to an array 4 of
intwould be:or
or
The three declarations are equivalent.