Question: c) 2-D array (20 pts) #define RAINBOWCOLOR 7 #define MAXLEN 6 int main(void) char rainbowcolors (RAINBOWCOLOR] [MAXLEN + 1] = {red, orange, yellow, green, blue,

c) 2-D array (20 pts) #define RAINBOWCOLOR 7 #define MAXLEN 6 int main(void) char rainbowcolors (RAINBOWCOLOR] [MAXLEN + 1] = {"red", "orange", "yellow", "green", "blue", "indigo", "violet"}; printf("rainbowcolors = {p ", rainbowcolors); printf("*rainbowColors = $p ", *rainbowColors); // 2 pts printf("rainbowColors [3][2] = $c ", rainbowColors [3] [2]); 1/ 2pts printf ("Grainbowcolors [2][2] = fp ", Grainbowcolors [2][2]); // 2 pts printf ("rainbowColors[4] = $s ", rainbowColors[4]); 1/ 2 pts printf ("Grainbowcolors[4] = $p ", Grainbowcolors[4]); 1/ 3 pts printf ("rainbowcolors [1] + 2 = &s ", rainbowcolors [1] + 2); // 3 pts printf("*(rainbowColors [5] + 3) = $c ", *(rainbowColors[5] + 3)); // 3 pts printf("Grainbowcolors [6] + 1 = fp ", Grainbowcolors [6] + 1); 1/ 3 pts return 0; } Output: (The output of the first printf is given. You can give decimal values for all pointer.) > rainbowColors - 1000; // Assume 1000 is decimal
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
