7/28/20

Variables in C Programming Language.


In any programming language, we have to write a lot of programs and do a lot of calculations. The result of these calculations is stored in any memory location. The memory location can be identified by the computer by its memory location address like- 55606, 55404, 55505, etc. Now Suppose, if a programmer wants to store the data at the memory location a lot of times when he writes the program. Then how difficult to remember the memory location by its address (numbers).

Variables

So, Variables are the name given by the programmer to a memory location to store data on it. You
can store any type of data on the memory location.
                                                                         OR
A Variable is an Entity given by the memory location where the data of your program are stored.

Ex:- 




Explanation:- On the above image, suppose this is cells of the memory locations. These cells have different addresses. Here we stored a data 52 in a memory location and give it name A. and also store 25 on the other memory location and give it the name Johnny.

So, “A” is the name of the variable where the data 52 has been stored. 

And “John” is the name of the variable where 25 has been stored.   


Before Creating a Variable name of your memory location there is some rule to construct variable names. Let's check it 

Rules for Constructing a Variable Names


A variable name can be constructed by a combination of 1-31 alphabets, digits, and underscore. Some compilers allow variable names up to 257 characters. But do not create unnecessary long variables. Because when you use it on your program you need to type long characters or words again and again.

  • The First Character of your variable must be an alphabet or underscore.
  • No comma or space is allowed on the variable names.
  • No Special symbols are allowed on the variable names. Except for underscore ( _ )   

Example of Variable Names:- 

  • var_a 
  • var_b10
  • int_x
  • int_x_123456 etc
In this tutorial, we learn about variables in c programming language If you find any mistakes on it. Or if you have any quarry related to it please comment below. Follow us for more programming tutorials.

You May Also Like 



0 comments:

Post a Comment

Like us on facebook

blogger templatesblogger widgets

Follow on Twitter

Linkedin

Categories

Blog Archive

Contact Form

Name

Email *

Message *

Mad About Computer. Powered by Blogger.