cplusplus.com
C++ : Forum : General C++ Programming : arrays
 
cplusplus.com
Information
Documentation
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs


post arrays

mnunez (7)
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 (3825)
int ArrayName[10];
buffbill (349)
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 (3825)
Not quite true:
int ArrayName [10] ={0};
only initialises the first element NOT the entire array.
Topic archived. No new replies allowed.