post  arrays

mnunez (7)   Link to this post
I'm having trouble trying to figure out what the best way to declare an array that will hold up to 10 integers. with the declaration format for the array being
DataType ArrayName[NumElements]; can anyone help? thank you

kbw (1476)   Link to this post
int ArrayName[10];
buffbill (194)   Link to this post
or........
int ArrayName []={0,1,2,3,4,5,6,7,8,9};// elements initialized to intended values
or........
int ArrayName [10] ={0};// all elements initialized to zero
kbw (1476)   Link to this post
Not quite true:
int ArrayName [10] ={0};
only initialises the first element NOT the entire array.

This topic is archived - New replies not allowed.