From 22c02515444232e396b2bb0042676e0e35007234 Mon Sep 17 00:00:00 2001 From: Hyder Hadi Date: Fri, 8 May 2026 18:30:12 +0300 Subject: Made the Highest Mark function and basic structs --- simple-C-programs/DynamicStudentList.c | 48 ++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 simple-C-programs/DynamicStudentList.c 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 +#include + +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 -- cgit v1.2.3