Automatic Array initialisation

This tip submitted by kedar on 2010-06-17 08:20:05. It has been viewed 10704 times.
Rating of 4.7 with 77 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!