Learn to Program with ZedLX

Free Online Programming Course for Beginners

Arrays [9/11]

To draw discs in various colors, this program introduces an array of colors. The array is named colors.

The discp function now takes an additional argument, colors[i], which specifies the color of each disc.

By using the same index i to access both the centers and colors arrays, the program ensures that each disc is drawn with the corresponding color.

Loading...