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
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};
dwk
Seek and ye shall find. quaere et invenies.
"Simplicity does not precede complexity, but follows it." -- Alan Perlis
"Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
"The only real mistake is the one from which we learn nothing." -- John Powell
Other boards: DaniWeb, TPS
Unofficial Wiki FAQ: cpwiki.sf.net
My website: http://dwks.theprogrammingsite.com/
Projects: codeform, xuni, atlantis, nort, etc.
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:Originally Posted by dwksThat will set the first value to 3, and the rest to zero.Code:int array[SIZE] = {3};