Identifiers or variables: what is it?

I am pretty confused by the few books in .NET that I read. Would there be someone to explain to me what an identifier is and how it differs from a variable? Or are the variables and identifiers the same?

Thanks in advance.

+6
variables identifier
source share
3 answers

The difference between a variable and an identifier is the same as between a person and his name.

The variable is not an identifier. The variable has an identifier. It also has a type and (if initialized) value.

For example, the instruction:

bool isClosed = true; 

declares and initializes a variable with the name (identifier) ​​isClosed, enter bool and value true .

Of course, we usually say: "isClosed is a variable ..." "isClosed is true" ... but just like we say "Peter is a software engineer", "John is tired" ... that is, we refer to a variable by its name.

+19
source share

Identifiers are the names that you choose to describe your classes, your methods, your variables, etc.

The identifier refers to the variable and denotes the area of ​​memory that can be manipulated using the identifier.

+13
source share

Identifiers are syntactic tools for identifying variables. Changes the reference memory inside your program, where you can save a value or a reference to an object. An identifier is a grammatical way of indicating this variable. Often the concept of identifiers is more expressed than just for variables. An identifier can also identify a method. Thus, the same grammar rules that apply to variable names also apply to naming methods and functions. Classes, methods, and variables are all identified by identifiers.

+1
source share

All Articles