Learn How to Program in C

by
Dr. Kristin Switala

Introduction

Directives

Variables

Conditionals

Loops

Arrays

Pointers

Strings

Functions

Structures


Site Map

Review: Arrays (c)

Instructions: Think about each question and write the answer in your notebook.


White Box Testing

1. Fix the errors in this C source code. There are 3 errors.

#include <stdio.h>
void main( )
{
int i;
int art[3][5] = {

{ 1874, 1876, 1877, 1878, 0 },
{ 1874, 1876, 1877, 1878, 1880 ,
{ 1874, 1876, 1877, 0, 0 }
};
printf("\nThe French Impressionists held 5 exhibitions from 1874-1880.");
printf("\nMonet \t Degas \t Sisley";
for(i = 0; i > 5; i++)
printf("\n%d \t %d \t %d", art[0][i], art[1][i], art[2][i]);

printf("\nMonet and Sisley did not participate in all of these exhibitions.\n");
}

Copyright
© 2001
Kristin Switala
Hosted by www.Geocities.ws

1