How do I access a variable in a one C file from another? -
i have 2 c files. want declare variable in one, able access c file. definition of example string might not perfect, idea.
//file1.c char *hello="hello"; //file2.c printf("%s",hello);
// file1.h #ifndef file1_h #define file1_h extern char* hello; #endif // file1.c // before // file2.c #include "file1.h" // rest before
Comments
Post a Comment