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

Popular posts from this blog

Add email recipient to all new Trac tickets -

400 Bad Request on Apache/PHP AddHandler wrapper -

php - Change action and image src url's with jQuery -