J
Johs32
I have the made the 3 following files:
1) my headerfile "draft.h":
struct tkb {
int *prio;
};
int init();
int test();
2) file with the implementation of the functions called "draft.c":
#include<stdio.h>
#include<stdlib.h>
#include "draft.h"
static struct tkb first_thread;
struct tkb *current = &first_thread;
int init()
{
int a = 222;
current->prio = &a;
printf("init :%d\n", *current->prio);
return 0;
}
int test()
{
printf("test : %d\n",*current->prio);
return 0;
}
3) And a file containing a main function that can use the functions called
"start.c":
#include "draft.h"
#include<stdio.h>
#include<stdlib.h>
int main()
{
init();
return 0;
}
but how do I compile the three files into a working program?
Johs
1) my headerfile "draft.h":
struct tkb {
int *prio;
};
int init();
int test();
2) file with the implementation of the functions called "draft.c":
#include<stdio.h>
#include<stdlib.h>
#include "draft.h"
static struct tkb first_thread;
struct tkb *current = &first_thread;
int init()
{
int a = 222;
current->prio = &a;
printf("init :%d\n", *current->prio);
return 0;
}
int test()
{
printf("test : %d\n",*current->prio);
return 0;
}
3) And a file containing a main function that can use the functions called
"start.c":
#include "draft.h"
#include<stdio.h>
#include<stdlib.h>
int main()
{
init();
return 0;
}
but how do I compile the three files into a working program?
Johs