0

what difference between identifier and variable

I am very confuse to define variable and identifier please give the answer with example

11th May 2018, 11:02 AM
deepak
deepak - avatar
3 Respostas
+ 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
11th May 2018, 12:01 PM
Rahul George
Rahul George - avatar
+ 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.
11th May 2018, 11:33 AM
Bebida Roja
Bebida Roja - avatar
+ 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
11th May 2018, 12:31 PM
Akib
Akib - avatar