I am just starting to learn the C language by creating small programs.
Now I am in the middle of creating a program that requires either a structure or something global, because later on somewhere in my function I just want to call them directly.
I prefer not to use struct because I am afraid that this will increase the likelihood of seg. an error somewhere between the lines of code.
My question is: are these two the same?
struct myTrialStruct{
char *trialOne;
char *trialTwo;
char *trialThree;
};
and
extern char *trialOne;
extern char *trialTwo;
extern char *trialThree;
char *trialOne;
char *trialTwo;
char *trialThree;
If not, can someone tell me the correct way to create a global char pointer without creating me a structure?
source
share