Hi,
I have an integer array and would like each value in it to be set to 0 when it is initialised. Could anyone tell me how to do this?
Thanks
-Chris
Printable View
Hi,
I have an integer array and would like each value in it to be set to 0 when it is initialised. Could anyone tell me how to do this?
Thanks
-Chris
Code:int array[SIZE] = {0};
It should be pointed out that if you want to initialise all the values to something other than zero, you can't do for example:Quote:
Originally Posted by dwks
That will set the first value to 3, and the rest to zero.Code:int array[SIZE] = {3};