variable and datatypes in c++

                          variable and data-types in c++


A variable provide us with named  a storge that our programs can be manipulate.

Each variable in c++ has a spacific type which determines the layout and size of the variables and the range of value that can be stored in memory, and the set of operations that can be applied on the variable.

Each variable needs an identifier that distingusihes if from the others.

The name of a variable can be composed of letter,digits and the underscore character. It must begin with either an underscore or a letter it cannot allows any other letter or spacial character.

Upper and lowercase letter are distinct because c++ is case-sensitive.
for example int x=5, char alphabet='a'

variable and datatypes in c++


A valid identifiers is a sequence of one or more letters, digits or underscore character(_). neither punctuation marks nor spaces or symbols cannot be the part of an identifier.

only letter , digits and single underscore character are valid.

Another rule that you have consider when inventing your own identifire is thet they cannot match any keyword of the c++ language nor your compiler's spacific one you cannot use reserv keywords, which are reserved keywords are:
asm, auto, bool, break, case, catch, char, class, const, continue, default, do, while, for, double, if, else, elseif, struct, int, long, public, private, protected, this, register, switch, typename, union, unsigned, enum, float, true, false, try, typedef

variable and datatypes in c++

Read this also:

 Example :

using namespace std;
void main()
          int a;

Hope you all are understood what is datatypes and variable so if you like the article don't forget to share it and if you have any question so ask me in comment and hit the notification bell to recive are post notification and join the c++ beginner tutorial "Thank you".......  

Post a Comment