I have a code where I use a pointer
One of the functions is in file 1
In the main file I call the function of file 1
When I pass the pointer it is not being defined,
I get Test is NULL message
What is the correct way for me to use this?
my code:
File 1
struct mystruct {
unsigned short id;
int number;
....
}
struct mystruct *test_check(state *ck, char *name);
void GetMytest(state *ck, char *name, struct mystruct *test) {
checkfield(ck, name);
test = test_check(ck, name);
.....
}
Main file
struct mystruct *test
void MainTest() {
state *ck = check_new();
.....
GetMytest(ck, "Stats", test);
if(test == NULL)
printf("Test is NULL");
}