Letters,numerical digits,and underscores character makes the variables of C++.C++ Variable names can not be used as keywords.A keyword is a word with a special meaning in C++.My_var,num6,int value,and first name are the C++ variables name.
3 is a invalid variable because it starts with a digit where $ is not because it contains a single quotation mark and begins with a $ (dollar)sign int is invalid because it contains a C++ keyword First name and also contains a space#.
C++ variables are case sensitive cause C++ knows the difference between upper and lower case characters.It means name,Name,and NaMe are written in three variable characters or words in C++.
C++,variables can be written as long as you want.A good and argonised rule is to give variables a meaningful names which are long enough to describe how the variables are used,but mantainning your work as easy as possible cause sometimes long sentences are hard to read causing you unnecessary typing.As an example,variable named as your Name will be described as your name by auto detecting upper and lower cases but do not put yn is to short to mean something.
0 comments:
Post a Comment