What is Variable and what are rules for defining a variable in C/C++.
What is Variable and what are rules for defining a variable in C/C++.?
Variables are like containers or holders of values. If you want to save an integer somewhere you have to assign it to a variable as such:
int someInteger = 4;
Now, here are some rules for defining a variable in C++:
1) The declaration of a variable consists of three parts (the type of the variable, the name of the variable, and the value you are assigning to the variable)
2) The name of the variable can't be a reserved word such as (string, int, double, this, class, main, return, etc.)
3) The value you assign to the variable has to be of the same type as the variable itself. Here are examples:
int a = 7; // this is good
double k = 2.4; // this is good
int c = 5.6; // this is bad because you are assigning a
// double to a variable of type int (integer)
Reply:a variable is like a box that contains a specific value,
u can use it or modify it.
there r 2 types of variable : global and local
and there r variables that can be as parameters that enter %26amp; leave a specific function.
Reply:The dictionary defines variable as
adjective:-
likely to change frequently:
or
noun [C] SPECIALIZED
a number, amount or situation which can change:
In computing terms a variable is a predefined type of memory allocation that can and probably will change its value.
Reply:variable is name of a block of memory address
Reply:there's a tutorial on www.functionx.com for C/C++
email cards
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment