Answer the question
In order to leave comments, you need to log in
Where to store global variables of struct type?
I want to store all the data coming from the sensors in one place and combine them into a structure, but the fields of this structure will change in different files (each interface has its own functions), so where should I declare it? the question arose because I already tried to combine all the functions of one interface into a structure, for example
struct typeSSP{
void (*initSSP1)();
void (*sendSSP1)();
};
struct typeSSP ssp = { ...};
Answer the question
In order to leave comments, you need to log in
There is no need to declare or initialize anything in header files.
Move extern struct typeSSP ssp; to the header file, and the ssp declaration itself and its initialization in SSP.c
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question