Learn How to Program in C

by
Dr. Kristin Switala

Introduction

Directives

Variables

Conditionals

Loops

Arrays

Pointers

Strings

Functions

Structures


Site Map

Review: Arrays (b)

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 5 errors.

#include <stdio.h>
void main( )
{
int i = 0;
int mars[2] = { 2, 3 };
int venus[3] = { 9, 10, 11, 12 };
printf("\nDuring the 1970s the USSR launched two probes to study the planet Mars:")
for(i = 0; i < 4; i++)

printf("\nMars %d", mars[i]);

printf("/nThey also launched four probes to study Venus:");
for(i = 0; i < 4; i++)
printf("\nVenera %d", venus[l]);

}

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

1