Is this name- a-variable-name for a variable wrong?.and if it is wrong then what's the reason. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Is this name- a-variable-name for a variable wrong?.and if it is wrong then what's the reason.

Plz reply

19th Apr 2020, 2:42 PM
Devang Soni
Devang Soni - avatar
5 Answers
+ 2
No, you can't as hyphen or dash is treated as subtract operator by the compiler...
19th Apr 2020, 2:56 PM
Arushi Singhania
Arushi Singhania - avatar
+ 15
Devang Soni variable name is not consist any hypen or special characters other than underscore that's why thr name you made for variable is wrong please read this naming convention. https://www.sololearn.com/learn/CPlusPlus/1624/?ref=app
19th Apr 2020, 2:53 PM
GAWEN STEASY
GAWEN STEASY - avatar
+ 1
What do you mean? Please clarify your doubt.
19th Apr 2020, 2:46 PM
A͢J
A͢J - avatar
0
I mean that if we want to name a variable then is this name wrong?- ' a-variable-name
19th Apr 2020, 2:50 PM
Devang Soni
Devang Soni - avatar
0
Yes , it's wrong Use _ Except -
20th Apr 2020, 6:50 PM
Arpan Bhattacharya
Arpan Bhattacharya - avatar