C Variables and its properties

By | February 20, 2024

Prerequisite – Introduction to C programming language, Variables in C
Variable is named location of data. In other words, variable is container of data. In real world we have used various type containers for specific purpose. For example, we have used suitcase to store clothes, match box to store match sticks etc. In the same way, variable of different data type is used to store different types of data. For example, integer variables are used to store integers, char variables are used to store characters etc.

On the basis of how many data a variable will store, we can categorize all C variable in three groups:

  1. Those variable, which can store only one data at a time.
    Example: Integer variable, Char variable, Pointer variable etc.
  2. Those variable, which can store more than one data of similar type at a time.
    Example: Array variables
  3. Those variable, which can store more than one value of dissimilar (or different) types at a time.
    Example: Structure of Union variables

Properties of C Variables :
Every variable in C have 3 most fundamental attributes. These are :

  1. Name
  2. Value
  3. Address

Every variable in C has its own name. A variable without any name is not possible in C. Most important properties of variables name are its unique names.

Also, no two variables in C can have same name with same visibility.

It is possible that two variable with same name but different visibility. In this case, variable name can access only that variable which is more local. In C, there is no way to access global variable is any local variable is present of same name.

You can watch this good video about this topic:

If you would like to contribute, you can also mail your article to raju.cplusplus@gmail.com. Please suggest your improvement for this article if you find anything incorrect.

Author: Mithlesh Upadhyay

I hold an M.Tech degree in Artificial Intelligence (2023) from Delhi Technological University (DTU) and possess over 4 years of experience. I worked at GeeksforGeeks, leading teams and managing content, including GATE CS, Test Series, Placements, C, and C++. I've also contributed technical content to companies like MarsDev, Tutorialspoint, StudyTonight, TutorialCup, and Guru99. My skill set includes coding, Data Structures and Algorithms (DSA), and Object-Oriented Programming (OOPs). I'm proficient in C++, Python, JavaScript, HTML, CSS, Bootstrap, React.js, Node.js, MongoDB, Django, and Data Science.