i have a serious problem to understand how to declare a global variable in an header file and how he need to be in the c file. In my .h : extern struct my_global_variable glob; and on my .c i add to reference it : struct my_global_variable glob; Is it like that ?? Thanks you for your answer and have
Tag: global-variables
Global variables in header only library
I’m writing a header-only logger library and I need global variables to store current logger settings (output flags, log file descriptor etc.). My thoughts: I can’t declare variables as extern, as i don’t have access to the translation units to define them I can’t just define global variables in header as it will lead to multiple definitions static variables in
Compare A Variable Regularaly Using Linux Scripts and Cron
I’m trying to check if a number differs from what it was last time it was checked, in this case checking a number every minute, using Linux scripts and cron. eg: But the problem I am having is that the variables aren’t accessible between scripts and using source (eg. source script.sh) runs the script again, hence getting the latest version,