aboutsummaryrefslogtreecommitdiff
path: root/simple-C-programs/DynamicStudentList.c
diff options
context:
space:
mode:
Diffstat (limited to 'simple-C-programs/DynamicStudentList.c')
-rw-r--r--simple-C-programs/DynamicStudentList.c48
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