I want to declare a structure in a header file so that I can use it in the source file. What am I doing wrong? I want to have access to my structure from any function.
info.h
#ifndef INFO_H #define INFO_H typedef struct info { int mem_size; int start_loc; int used_space; int free_space; } INFO; #endif
test.c
#include <stdio.h> #include <stdlib.h> #include <info.h> #define F_first 1 #define F_last 2 #define F_data_int 3 #define F_data_char 4 #define F_data_float 5 #define F_print 6 void * f(int code); int main() { INFO in; in.mem_size = 8; f(F_last, 0,0); return(0); } void * f(int code) { printf("%d", in.mem_size); }
Nelson.b.austin
source share