Version One

Take a look at this program (``array1.c'' in your ``examples'' directory). It prompts the user for and reads ten numbers, and then prints them all back out. What is clumsy about it?

Click here for the answer

The program cries out to be simplified by using a for loop to repeat the statements:

  printf("Please enter an integer: ");
  scanf("%d", &n0);

ten times over, and by using another for loop to repeat the statement:

  printf("%d\n", n0);

ten times over. Unfortunately, this is not possible. Why not?

Click here for the answer.

Eric N. Eide
Hamlet Project
Department of Computer Science
University of Utah