transcode/examples/switch.c
2011-07-13 00:42:27 +02:00

30 lines
352 B
C

#include <stdint.h>
int main ( void ) {
char hello[] = "Hello World!";
char *str_p = hello;
uint8_t l_count = 0;
uint8_t o_count = 0;
uint8_t else_count = 0;
do {
switch (*str_p) {
case 'o':
o_count++;
break;
case 'l':
l_count++;
break;
default:
else_count++;
}
++str_p;
} while (*str_p);
return 0;
}