-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample_code.c
More file actions
67 lines (51 loc) · 1.07 KB
/
example_code.c
File metadata and controls
67 lines (51 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#include <stdio.h>
#include <math.h>
#define PI 3.1415
#define MAX(a,b) ((a) > (b) ? (a) : (b))
typedef struct {
int id;
char name[50];
} Student;
int global_var = 100;
void print_student(Student* s) {
printf("ID: %d, Name: %s\n", s->id, s->name);
}
int main() {
int a = 10, b = 20;
float radius = 5.5;
double area = PI * radius * radius;
char grade = 'A';
char* msg = "Processing student data...";
char 89a = 'a';
Student s1 = { .id = 1, .name = "Alice" };
print_student(&s1);
int max_val = MAX(a, b);
if (a < b && radius > 0.0) {
a += 5;
} else {
b -= 2;
}
for (int i = 0; i < 5; i++) {
area += i;
}
while (a > 0) {
a--;
}
do {
b++;
} while (b < 25);
switch (grade) {
case 'A':
printf("Excellent\n");
break;
case 'B':
printf("Good\n");
break;
default:
printf("Needs Improvement\n");
}
return 0;
}
#ifdef DEBUG
printf("Debug mode enabled\n");
#endif