Created
August 26, 2024 02:29
-
-
Save muaddib1971/e6c756eaf6df32c09a005b5dd7fc2736 to your computer and use it in GitHub Desktop.
week4
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#define SIZE 10 | |
int main() { | |
/* int * i; */ | |
/* printf("%d\n", *i); */ | |
int array[] = {0,1,2,3,4,5,6,7,8,9,0}; | |
int count; | |
for(count = 0; count < SIZE; ++count) { | |
printf("%d\n", array[count]); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
enum DAYS { | |
SUN=1, MON, TUE, WED, THU , FRI, SAT }; | |
const char * days[] = { "SUN", "MON", "TUES", "WED" , "THUR", "FRI", "SAT"}; | |
//typedef enum DAYS DAYS; | |
int main() { | |
for (enum DAYS day = SUN; day <= SAT; ++day) { | |
printf ( "%s is day number %d\n", days[day-1], day); | |
switch(day){ | |
case SUN: | |
printf("it is sunday\n"); | |
break; | |
case MON: | |
printf("is is monday\n"); | |
/* fallthrough */ | |
default: | |
printf("it is some other day.\n"); | |
} | |
} | |
return EXIT_SUCCESS; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment