Today, I encountered a tangled problem during the course design process. How to extend the global variables in one file to another file ?
The code is as follows:
test1.c
//External global variable
int SendBuff[SENDBUFF_SIZE];
//Other functions, you can use the global variable above
void othermethod(void)
{
//...
}
test2.c
//Extend the scope in the global variable to this file
extern int SendBuff[SENDBUFF_SIZE];
int main(void)
{
//...
}