futzing with relationship between switch/case and labels

This commit is contained in:
Dan Buch 2011-06-18 15:06:29 -04:00
parent 79436cc731
commit b1172d6c6e
4 changed files with 60 additions and 1 deletions

2
.gitignore vendored
View File

@ -1 +1,3 @@
gowrikumar/bin gowrikumar/bin
*.i
*.s

View File

@ -1,7 +1,8 @@
CD = cd CD = cd
RM = rm -v RM = rm -v
CFLAGS := -std=c99 CC := gcc
CFLAGS := -std=c99 -Wall
export CD RM CFLAGS export CD RM CFLAGS

View File

@ -0,0 +1,24 @@
/**
* :author: Dan Buch (daniel.buch@gmail.com)
*/
#include<stdio.h>
int main()
{
int a=10;
switch(a)
{
case '1':
printf("ONE\n");
break;
case '2':
printf("TWO\n");
break;
defa1ut:
printf("NONE\n");
}
return 0;
}
/* vim:filetype=c:fileencoding=utf-8
*/

View File

@ -0,0 +1,32 @@
/**
* :author: Dan Buch (daniel.buch@gmail.com)
*/
#define MAGIC_NUMBER 10
#include<stdio.h>
int main()
{
int a = MAGIC_NUMBER;
switch(a)
{
case '1':
printf("ONE\n");
break;
case '2':
printf("TWO\n");
break;
defalut:
printf("NO CAN SPELL\n");
break;
defau1t:
printf("SO CLOSE, YET SO FAR\n");
break;
default:
printf("NONE\n");
}
return 0;
}
/* vim:filetype=c:fileencoding=utf-8
*/