Compare the Difference Between Similar Terms

Difference Between

Home / Technology / IT / Programming / Difference Between Identifier and Variable

Difference Between Identifier and Variable

February 14, 2018 Posted by Lithmee

Key Difference – Identifier vs Variable
 

A programming language is designed to process certain kind of data and to provide useful information. The data can be numbers, characters, strings, etc. A program is a set of instructions written in a specific programming language to provide instructions to a computer. The computer process data according to the instructions. When manipulating data, it is necessary to store them. A variable is a storage area capable of holding a value. The variables have names to identify them. Not just variables, functions, classes, etc. also have names, which are called identifiers. Identifiers are created by the programmer. Identifier and variable are two common terms in programming. The key difference between identifier and variable is that an identifier is a name given to a variable, function, array, class or structure while a variable is a name given to a memory location that can hold a value.

CONTENTS

1. Overview and Key Difference
2. What is an Identifier
3. What is a Variable
4. Similarities Between Identifier and Variable
5. Side by Side Comparison – Identifier vs Variable in Tabular Form
6. Summary

What is an Identifier?

An identifier refers to a name of a variable, function, array, class or structure. The identifiers are created by programmers.  It is important to use unique names for identifiers because they are identified in the execution of the program. Programming languages follow a specific set of rules to name identifiers. Most of the time, only alphabetical characters (A to Z or a to z), underscore (_) and digits (0 to 9) are used for valid identifiers. Generally, the first character of the identifier can be an underscore or a letter, and should not be a digit.

In programming, if there is a statement as int number; it means that there is a variable called number which can hold an integer value. The word ‘number’ is an identifier.  When there is a statement as double area; it means that there is a variable called area that can hold a double value. The ‘area’ is a valid identifier.  Some examples of valid identifiers are age, salary, studentNo, amount and _empNo. Some examples of invalid identifiers are 123abc, -studentno. The identifier 123abc starts with a digit. So, it is invalid. The identifier -studentno starts with a character other than alphabetical character or underscore.

Difference Between Identifier and Variable

Figure 01: Identifier and Variable

Most programming languages are case sensitive. Therefore, lowercase and uppercase letters are distinct. The identifier amount and AMOUNT are two separate identifiers even they have the same name. It is important to use meaningful names for identifiers because it improves code readability. Meaningful identifiers also make the program easy to understand.

What is a Variable?

In programming, it is required to store data. Computations are carried on the stored data. These data should be stored in a memory location. A variable is a container or a storage area to hold data. A unique name or an identifier is given to variables to identify each storage area. Variable names represent the memory locations to store data. Each variable has a specific data type to store.

In the variable declaration, the variable name is specified, but there is no memory allocated for the variable. When there is a statement as int number; it means that the variable name is number and it can store an integer value. But does not set aside any memory for the variable number. Assigning an initial value for the variable is called initialization. When there is a statement as int number = 5; the variable number can store an integer value and it is initialized to 5.

What is the Similarity Between Identifier and Variable

  • Both Identifier and Variable are used in programming.

What is the Difference Between Identifier and Variable?

Identifier vs Variable 

An identifier is a name given to a variable, function, array, class or structure. A variable is a name given to a memory location that can hold a value.
 Range
The range of identifiers is higher than variables. Variables names are identifiers.
Usage
An identifier is used to give a unique name to an entity. A variable is a unique name to identify a memory location.

Summary – Identifier vs Variable

In programming, there are so many concepts such as variables, functions, classes etc. The main purpose of each is to manipulate data correctly to solve computation problems. The variables, function, classes should be given appropriate names in order to identify them and to understand the program. Identifiers are the names given to them. The data is stored in memory, and these memory locations should be given names to identify them. This article discussed the difference between the identifier and a variable. The difference between identifier and variable is that an identifier is a name given to a variable, function, array, class or structure while a variable is a name given to a memory location that can hold a value.

Download the PDF of Identifier vs Variable

You can download the PDF version of this article and use it for offline purposes as per citation note. Please download the PDF version here: Difference Between Identifier and Variable

Reference:

1.tutorialspoint.com. “Java Basic Syntax.” The Point, Available here  

Related posts:

Difference Between Identifier and KeywordDifference Between Identifier and Keyword Difference Between Instance Variable and Local Variable Difference Between Integer and Pointer Difference Between Semaphore and Mutex Difference Between Waterfall Methodology and RUP

Filed Under: Programming Tagged With: Compare Identifier and Variable, Identifier, Identifier and Variable Differences, Identifier and Variable Similarities, Identifier Definition, Identifier Function, Identifier Range, Identifier Types, Identifier Usage, Identifier vs Variable, variable, Variable Definition, Variable Function, Variable Range, Variable Types, Variable Usage

About the Author: Lithmee

Lithmee Mandula is a BEng (Hons) graduate in Computer Systems Engineering. She is currently pursuing a Master’s Degree in Computer Science. Her areas of interests in writing and research include programming, data science, and computer systems.

Leave a Reply Cancel reply

Request Article

Featured Posts

Difference Between Coronavirus and Cold Symptoms

Difference Between Coronavirus and Cold Symptoms

Difference Between Coronavirus and SARS

Difference Between Coronavirus and SARS

Difference Between Coronavirus and Influenza

Difference Between Coronavirus and Influenza

Difference Between Coronavirus and Covid 19

Difference Between Coronavirus and Covid 19

You May Like

Difference Between Assembler and Interpreter

Difference Between Oxidases and Oxygenases

Difference Between Oxidases and Oxygenases

Difference Between Partition Coefficient and Distribution Coefficient

Difference Between Partition Coefficient and Distribution Coefficient

Difference Between Loss and Lost

Difference Between Sustainability and Sustainable Development

Latest Posts

  • Difference Between SDP and RDP
  • Difference Between Alcoholic and Non-alcoholic Fatty Liver
  • Difference Between Neostigmine and Physostigmine
  • Difference Between Resonance and π Conjugation
  • Difference Between Equational Division and Reduction Division
  • Difference Between Electron Affinity and Electron Gain Enthalpy
  • Home
  • Vacancies
  • About
  • Request Article
  • Contact Us

Copyright © 2010-2018 Difference Between. All rights reserved. Terms of Use and Privacy Policy: Legal.