故意利用break 的switch

/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
/*
* main.c
* Copyright (C) 2013 evan
*/

#include
void print_day(int day)
{
switch (day)
{
case 1:
case 2:
case 3:
case 4:
case 5:
printf ("Weekday n");
break;
case 6:
case 7:
printf ("Weekend n");
break;
default:
printf ("Illegal day numbern");
break;
}
}
int main()
{
print_day (2);
return (0);
}

发表评论

电子邮件地址不会被公开。 必填项已用*标注