Hi there,
Could you give an example of what you mean please? :)
Do you mean how you can distinguish a global variable from a local variable (eg in a function)?
In that case I don't think that is possible in C++.
All the best,
NwN
Clarify the question?
Let me try to give an answer anyways:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
|
int Variable = 0; // (1) Global Variable
void Function() {
Variable = 1; // Uses (1)
}
void Function2(int Variable) { // (2) Parameter
Variable = 1; // Uses (2)
::Variable = 1; // Uses (1)
}
void Function3(int Variable) { // (2) Parameter
Variable = 1; // Uses (2)
::Variable = 1; // Uses (1)
int Variable = 0; // (3) Local Variable
Variable = 1; // Uses (3)
::Variable = 1; // Uses (1)
}
|
Last edited on
huhu,
i mean, what is global parameter n actual parameter
I don't think "global parameter" has any meaning. It's not an expression I would use anyway.
Last edited on
Any parameter of a function is a local entity inside the function even if it is passed by reference.
EDIT: I'd like to append that according to the C++ standard "actual parameter" is an argument of a function. That is it is not a parameter.
From the C++ standard:
argument
actual argument
actual parameter
<function call expression> expression in the comma-separated list bounded by the parentheses |
Last edited on