Automatic Array initialisation
This tip submitted by kedar on 2010-06-17 08:20:05. It has been viewed 2373 times.
Rating of 6.4 with 11 votes
If you want to initialise each array element to ZERO, you would code like this:
for(i=0;i
You can also initialise the entire array without using the for loop.
For example:
int a[10]={0};
Nice and convenient!
More tips
Help your fellow programmers! Add a tip!