Wednesday, 2 January 2019

Variables in C

In programming, we actually work with some data. Suppose we are going to add two numbers 3 and 5. So, where are we going to store this value and do addition? Here, we use variable. 

So, variable is an identifier that is used to store some value. Values are actually stored in memory location and variable is the name of that storage location or memory location. 

A variable represents a single data item. By variables or variable name, we can access the data item anywhere in the program. Different data item can be stored at any place of the program.

Variable is an identifier, so rules of identifier should be used here. 

-- Variables are constructed with digits, letters.
-- But variable name must begin with letter (underscore is also allowed at the beginning).
-- Variables are case sensitive.
-- Special symbols are not allowed(i.e. ",',% or blank space etc. ).

We can declare variable in following way:

data_type  variable_name 

We will discuss about data_type in another section. Example of some valid variables are as follows:

First_tag
max_number;

No comments:

Post a Comment

What Is The Difference Beween Numerals and Number?

Number is a concept, it is a mathematical concept. To express the quantitative value of the object, this  is developed in ancient history. S...