diff options
| author | Hyder Hadi <hyder@hyderhadi.xyz> | 2026-05-08 18:30:12 +0300 |
|---|---|---|
| committer | Hyder Hadi <hyder@hyderhadi.xyz> | 2026-05-08 18:30:12 +0300 |
| commit | 22c02515444232e396b2bb0042676e0e35007234 (patch) | |
| tree | 06324535df780673be4d93ea0d5956c8e8d6b13e /simple-C-programs/DynamicStudentList.c | |
| parent | 390e72011a130eece804499b3f64fc0f4f29da94 (diff) | |
Made the Highest Mark function and basic structs
Diffstat (limited to 'simple-C-programs/DynamicStudentList.c')
| -rw-r--r-- | simple-C-programs/DynamicStudentList.c | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/simple-C-programs/DynamicStudentList.c b/simple-C-programs/DynamicStudentList.c new file mode 100644 index 0000000..e3e0775 --- /dev/null +++ b/simple-C-programs/DynamicStudentList.c @@ -0,0 +1,48 @@ +#include <stdio.h> +#include <stdlib.h> + +struct Student { + char *__name; + int __age; + int __mark; + struct Student *__next; +}; + +struct StudentList { + struct Student *__head; + struct Student *__tail; + int __count; + + // Methods; + + int (*highest) (struct StudentList *self); + void (*sort) (struct StudentList *self); +}; + + +int Highest_mark (struct StudentList *self) { + int def = 0; + int res; + struct Student *tmp = NULL; + + if(self->__head != NULL) { + for(tmp = self->__head; self->__count > 0; tmp = tmp->__next) { + if(tmp->__mark > tmp->__next->__mark) { + res = tmp->__mark; + } + } + return res; + } + + return def; +} + +void Sort_by_mark(struct StudentList *self) { + +} + + +int main() { + + return 0; +}
\ No newline at end of file |
