Q:

Can character array be using switch case in c

void main()
{
  char day[20];
  printf("Enter the short name of day");

  scanf("%s", day);

  switch(day)
  {
    case "sun":
      printf("sunday");
      break;
    case "mon":
      printf("monday");
      break;
    case "Tue":
      printf("Tuesday");
      break;
    case "wed":
      printf("wednesday");
      break;
    case "Thu":
      printf("Thursday");
      break;
    case "Fri":
      printf("friday");
      break;
    case "sat":
      printf("saturday");
      break;
  }
}

This is my code. I got an error in switch case part.switch case not checking these cases. pls help me.
thanks in advance.

A:

Using c, the only way I'm aware of is:
if (strcmp(day, "sun") == 0) 
{
   printf("sunday");
} 
else if (strcmp(day, "mon") == 0)
{
   printf("monday");
}
/* more else if clauses */
else /* default: */
{
}

