// COMP1511 lecture example // // Print "Andrew Rocks!" - using character constants to get the ASCII codes for the characters, // initialize an array to the values , and print the array. // Note we have to track the array length. // // Andrew Taylor - andrewt@unsw.edu.au // 9/4/2017 #include #define LENGTH 14 int main(void) { // if we don't specify the size of an array being initialized C will make // it big enough to hold all the initializing elements (14 in this case) int asciiCodes[] = {'A','n','d','r','e','w',' ','R','o','c','k','s','!','\n'}; int i; i = 0; while (i < LENGTH) { putchar(asciiCodes[i]); i = i + 1; } return 0; }