0
what difference between identifier and variable
I am very confuse to define variable and identifier please give the answer with example
3 Antworten
+ 4
* Difference Between Identifier and Variable*
"...
an identifier is a “name given to entity” in a program whereas, a variable is a “name given to memory location”, that is used to hold value, which may get modified during program execution.
..."
Source: https://techdifferences.com/difference-between-identifier-and-variable.html
+ 1
Ex. in C++:
std::string myName;
This code initializes a *variable* of *type* std::string and *identifier* myName. These are the codewords to define a variable. The identifier of a variable is just its name.
+ 1
Variable - stores data of a particular type
int x = 46;
'x' is identifier of x variable (It gets kinda confusing if you think like that. just remember the following)
Identifier - name of a variable/class/function