Skip to content

Instantly share code, notes, and snippets.

@muaddib1971
Created August 26, 2024 02:29
Show Gist options
  • Save muaddib1971/e6c756eaf6df32c09a005b5dd7fc2736 to your computer and use it in GitHub Desktop.
Save muaddib1971/e6c756eaf6df32c09a005b5dd7fc2736 to your computer and use it in GitHub Desktop.
week4
#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]);
}
}
#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