+ 2

what is the difference between variable, variable name and identifier?

26th Dec 2017, 3:48 PM
Mansi Saini
Mansi Saini - avatar
9 Answers
+ 6
In computer programming, a variable or scalar is a storage location paired with an associated symbolic name (an identifier), which contains some known or unknown quantity of information referred to as a value. The variable name is the usual way to reference the stored value; this separation of name and content allows the name to be used independently of the exact information it represents. The identifier in computer source code can be bound to a value during run time, and the value of the variable may thus change during the course of program execution.
26th Dec 2017, 4:33 PM
Scooby
Scooby - avatar
+ 6
An identifier, in C#, is the user-defined name of a program element. It can be a namespace, class, method, variable or interface. Identifiers are symbols used to uniquely identify a program element in the code. They are also used to refer to types, constants, macros and parameters. An identifier name should indicate the meaning and usage of the element being referred. C# is a programming language that is compiled and has its implementation such that the identifiers are only compile-time entities. During run time, each identifier will be referred by its reference to the memory address and offset the compiler assigned to its textual identifier token.
26th Dec 2017, 4:34 PM
Scooby
Scooby - avatar
+ 6
An Indetifier can only have alphanumeric characters( a-z , A-Z , 0-9 ) and underscore( _ ). The first character of an identifier can only contain alphabet( a-z , A-Z ) or underscore ( _ ). Identifiers are also case sensitive in C. For example name and Name are two different identifier in C.
26th Dec 2017, 4:35 PM
Scooby
Scooby - avatar
+ 6
ok..wait
26th Dec 2017, 4:57 PM
Scooby
Scooby - avatar
26th Dec 2017, 4:59 PM
Scooby
Scooby - avatar
+ 6
Some examples are − extern int d = 3, f = 5; // declaration of d and f. int d = 3, f = 5; // definition and initializing d and f. byte z = 22; // definition and initializes z. char x = 'x'; // the variable x has the value 'x'.
26th Dec 2017, 5:02 PM
Scooby
Scooby - avatar
26th Dec 2017, 5:03 PM
Scooby
Scooby - avatar
+ 1
Thanks a lot but it would be of great help if you could give some examples to differenciate between the three.... {if possible explain them in one example :)}
26th Dec 2017, 4:55 PM
Mansi Saini
Mansi Saini - avatar
0
Is there any difference between defining/declaraing a variable name and identifier?
26th Dec 2017, 5:51 PM
Mansi Saini
Mansi Saini - avatar