[comp.lang.c] name printing

garath@ais.org (Belgarath) (01/18/91)

     I have the following lines in a program that get no errors, but do not
run the way I would like.  This is on Turbo C for an IBM:
main() {
  static char *days[7] = {"Saturday","Sunday",etc....};
  int day_of_the_week;
  /* day of the week is evaluated to a number between 0 and 6 here */
  then:
  printf("The day of the week is %s", days[day_of_the_week]);
}
 
     Obviously all the calculations are cut out, but when it prints it either
prints "The day of the week is (null)" or it prints all kinds of graphic 
characters.  I even made it %c for a second in desperation (but changed back to %s)
     Please respond through e-mail, thanks.

-- 
*------------------------------------------------------------------*
| Scott            | The University of Michigan, Ann Arbor         |
| garath@ais.org   | Computer Science Major                        |
*------------------------------------------------------------------*