Section 18.5 Bad Variable Names
Here is a really nasty example. Don’t ever write code with variable names like this! In the code, towards the right-hand side, comments are there to help you tell the scope of the variables and functions.
-
all: global scope - can be used anywhere (in main and functions)
-
main: scope is the main function, not known elsewhere
-
one: scope is function one
-
two: scope is function two
-
the function one cannot be called from the function two because of a conflict: in function two, there is a variable parameter that is called one and so this is what the function two will ’think of’ when it ’sees’ one.
-
So, function one can be called from main and it can be called from within itself, but it cannot be called from two.