implemented data structure

This commit is contained in:
Hendrik Schutter 2019-05-07 21:39:02 +02:00
parent 097362ece5
commit af93431a4b
3 changed files with 110 additions and 0 deletions

BIN
src/routing4SITA Executable file

Binary file not shown.

79
src/routing4SITA.c Normal file
View File

@ -0,0 +1,79 @@
#include <stdio.h>
#include "routing4SITA.h"
int main() {
printf("hello world!\n");
NODE_t end;
end.id = 8;
end.nodescount = 0;
NODE_t g;
g.id = 7;
g.nodescount = 0;
NODE_t f;
f.id = 6;
f.nodescount = 1;
f.nodesnext[0] = &end;
f.nodescost[0] = 7;
NODE_t e;
e.id = 5;
e.nodescount = 0;
NODE_t d;
d.id = 4;
d.nodescount = 0;
NODE_t c;
c.id = 3;
c.nodescount = 1;
c.nodesnext[0] = &end;
c.nodescost[0] = 3;
NODE_t b;
b.id = 2;
b.nodescount = 3;
b.nodesnext[0] = &e;
b.nodescost[0] = 11;
b.nodesnext[1] = &f;
b.nodescost[1] = 42;
b.nodesnext[2] = &g;
b.nodescost[2] = 8;
NODE_t a;
b.id = 1;
b.nodescount = 2;
b.nodesnext[0] = &c;
b.nodescost[0] = 15;
b.nodesnext[1] = &d;
b.nodescost[1] = 27;
NODE_t start;
b.id = 0;
b.nodescount = 2;
b.nodesnext[0] = &a;
b.nodescost[0] = 72;
b.nodesnext[1] = &b;
b.nodescost[1] = 32;
return 0;
}

31
src/routing4SITA.h Normal file
View File

@ -0,0 +1,31 @@
#ifndef ROUTING4SITA_H
#define ROUTING4SITA_H
#define MAX_CHILDREN 3
typedef struct node NODE_t;
struct node {
int id;
int nodescount;
NODE_t* nodesnext[MAX_CHILDREN];
int nodescost[MAX_CHILDREN];
};
#endif /* ROUTING4SITA_H */