Click here to Skip to main content
15,900,511 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Why i can't initialize multidimensional array in main function?
C++
int main()
{
arr[10][10][10];
int a,b,c;
}
Posted

1 solution

Array of what? You need a type for your array elements.
int arr[10][10][10];


In practice this may not to be a good idea as it can complicate the array access code somewhat and it has very little advantage if any over
int arr[1000];


There's nothing to stop you treating this as a multidimensional array any you may find the code actually turns out to be easier to write.
Up to you really which you prefer.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900