Global Variabels

How if it's possible, can I make global vars that I can use in more than 1 file.

I tryed with doing it in a header file but without success...

Thanks in advance.:rolleyes:

You could do this a couple of ways.

1) You could add the variables to your profile....~/.profile - so that when that user signs on the variables are set for them.
2) You could create an environment file that other files set when they want. Include your vairables in this file , then use them in your script with a .filename

These are both methods that I use.

Yes but this is not for a script.
Sorry about not specifing language.
This is a C issue. And the programs is a bigger project with multiple files.
But thanks anyway :slight_smile:

You can use global variables in multiple files by declaring it as extern <variable name> in the file where you want to use.Also, include that file where you have defined the variable.This keyword will inform the compiler that it is a global variable which is already declared.So it doesn't allocate memory.

bye,
sharath

Okey, thanks allot! I will try with that.