+ 1

Variable Naming rules ?

in C++ Course, section 3. it stated as follow : Variable Naming Rules C++ keyword (reserved word) cannot be used as variable names. For example, int, float, double, cout cannot be used as a variable name. i used cout as variable name , and it work.😁😁😁 https://code.sololearn.com/cE1321gl4m1X/?ref=app

13th May 2017, 5:54 AM
Setiawan Next
Setiawan Next - avatar
2 Answers
+ 5
That's because "cout" is not a reserved word. It's actually a variable, and as such is subject to variable naming rules itself. Another reason you're allowed to use it is the fact it exists in the "std" namespace. If you use "using namespace std;" (thus moving it into the global namespace), you'll get an error since it will already be defined.
13th May 2017, 6:09 AM
Squidy
Squidy - avatar
+ 1
thanks @Squidy
13th May 2017, 6:10 AM
Setiawan Next
Setiawan Next - avatar