Puzzle SL39

What does the following write to the monitor?

#include <stdio.h>

int nextPrime()
{
  static int primes[] = { 2, 3, 5, 7, 11, 13, 17, 23 };
  static int index = -1;
  index++ ;
  return primes[index];
}

void main()
{
  printf("prime: %d\n", nextPrime() );
  printf("prime: %d\n", nextPrime() );
  printf("prime: %d\n", nextPrime() );
}


Answer         Next Page         Previous Page Home