Total Pageviews

Friday 25 January 2013

GOOD BOOKS FOR LEARNING C:

1)Let Us C by Yashavant Kanetkar
2)The Complete Reference C by Herbert Schildt
3)Computer Programming by Ashok N. Kamthane
HOW TO INITIALISE ALL THE ARRAY ELEMENTS TO A VALUE IN ONE LINE?

Eg:

int arr[100]={[0 ... 99]=-1};

A space must be given after 0 and before 99.

One thing to note is that the above initialisation is possible only if the array index starts from 0. For eg., the following statement will throw an error,

int arr[100]={[1 ... 100]=5};