Quote:
|
Originally Posted by Adam Shapiro
You can use a #define statement in a globally-included header file to create global constants. You can also use extern to define global variables.
|
What exactly do you mean by "globally-included header file"? When you use #define to create a global constant, it does not have a type. Do you have to typecast it whenever you use it?
For example:
Code:
user_routines.c
#define axelWidth 1234
...
void fn(void)
{
...
x*=axelWidth; //Can it be this?
x*=(int)axelWidth; //Or must it be this?
x=x*(axelWidth); //This seems to be the only form that the compiler likes
...
}
...
In C++ you can declare global constants using
const varType varName = initialValue; Is this acceptable in C?
Please clarify!!!