aboutsummaryrefslogtreecommitdiff
path: root/simple-C-programs/DynamicStudentList.c
blob: e3e077583a2178addd8c247bafd3a65b7030b963 (plain)
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
#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;
}