Published on: Mon Mar 01 2010

To Declare an array type name[#]; int fish[3]; To Access an Array name[#] fish[2] int i=2; fish[i]; fish[8-3*i] The name of an array refers to the spot in memory to begin storing. The index tells how much to offset. WATCH for Array index out of bounds. C doesn’t warn you, it just writes over something else. float sample[5]= {[2]=50.2,[1]=110.0} Will make all other indices 0. int name[5] = {1,2,4,5,6}; int name[20] = {5,6,7}; the first three values are 5, 6 and 7 everything else is 0 Sparse Arrays, are very few non zero values. You can create arrays of characters char myString[]={“Hello!”}; // This is a 7 character string The memory uses the 7th spot to store which is a numeric character for null. Anything inside of “ “ is a string char letters[5] {‘A’,’B’,’C’,’D’,’E’};