futzing with relationship between switch/case and labels
This commit is contained in:
parent
79436cc731
commit
b1172d6c6e
2
.gitignore
vendored
2
.gitignore
vendored
@ -1 +1,3 @@
|
||||
gowrikumar/bin
|
||||
*.i
|
||||
*.s
|
||||
|
3
Makefile
3
Makefile
@ -1,7 +1,8 @@
|
||||
CD = cd
|
||||
RM = rm -v
|
||||
|
||||
CFLAGS := -std=c99
|
||||
CC := gcc
|
||||
CFLAGS := -std=c99 -Wall
|
||||
|
||||
export CD RM CFLAGS
|
||||
|
||||
|
24
gowrikumar/src/05-switchint.c
Normal file
24
gowrikumar/src/05-switchint.c
Normal 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
|
||||
*/
|
32
gowrikumar/src/05b-switchint.c
Normal file
32
gowrikumar/src/05b-switchint.c
Normal 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
|
||||
*/
|
Loading…
Reference in New Issue
Block a user