-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain2.c
42 lines (32 loc) · 1010 Bytes
/
main2.c
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
// dynamic
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "lib_inc.h"
int main (void)
{
inc_t inked[2]; // malloc this inside the init function
inc_init(&inked[0]);
inc_init(&inked[1]);
inc_set_fn(&inked[1], 1);
// link a node to the graph
// each created node needs a global index
uint32_t node_ix = 0;
// add_inc( node_ix++, <source_link> );
// add_inc( node_ix++, 0 ); // hard link to first add
// rather than the above, use a standard linked list
// just create the linked structure
// compile the graph to arrays
// check if the node exists
// if not, init() one of those nodes
// save *node to the LL & make a reference to it
//
// compute the arrays
float result;
result = (inked[0].func_ptr)(&inked[0], result); // result should be 4.0
result = (inked[0].func_ptr)(&inked[0], result); // result should be 4.0
result = (inked[1].func_ptr)(&inked[1], result); // result should be 4.0
// output
printf("result: %f\n\r", result);
return 0;
}