Sorry this is a basic question, but all my research just barely missed answering my question and I just wanted to double check before I write all my code with an assumption.
I’m using C and I have a header file with some variables declared (ints, char arrays, int arrays). If I have a function that makes use of these global variables I am assuming that I can use the variables without passing them?
EXAMPLE
HEADER FILE:
int state;
int lnArray[];
C FILE:
void function(){
int i;
for(i=0;i<5;i++;){
if(lnArray[i]<10)
state = lnArray[i];
}
}
That’s correct. It’s why they’re called “global” variables: they’re available in any scope.