Assuming I link the library correctly to the executable project can I define k in the library then use in the executable as seen below? Is this legal?
Project A (library): libtest.libc
libA.c
#include "lib.h" int k = 0;
libB.c
#include "lib.h" m = k+1;
lib.h
extern int k;
Project B (executable): main.c
#include "lib.h" r = k*2
Thanks