Lets say I have an array like
int arr[10][10];
Now i want to initialize all elements of this array to 0. How can I do this without loops or specifying each element?
Please note that this question if for C
c++
Lets say I have an array like
int arr[10][10];
Now i want to initialize all elements of this array to 0. How can I do this without loops or specifying each element?
Please note that this question if for C
Best Answer
The quick-n-dirty solution:
If you initialise any element of the array, C will default-initialise any element that you don't explicitly specify. So the above code initialises the first element to zero, and C sets all the other elements to zero.