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 



"+y+""}else{if(A==5){c+='
  • '+w+""+y+"
  • "}else{if(A==6){c+='
  • "+w+'
    '+u+""+y+"
  • "}else{c+='
  • "+w+"
  • "}}}}}s.innerHTML=c+=""+y;d.callBack()};randomRelatedIndex=h;showRelatedPost=g;j(d.homePage.replace(/\/$/,"")+"/feeds/posts/summary"+e+"?alt=json-in-script&orderby=updated&max-results=0&callback=randomRelatedIndex")})(window,document,document.getElementsByTagName("head")[0]); //]]>

    0 comments:

    Post a Comment

    Follow on Twitter

    Linkedin

    Categories

    Blog Archive

    Contact Form

    Name

    Email *

    Message *

    Mad About Computer. Powered by Blogger.
    This site is in no way affiliated with or endorsed by specified business. It exists as a compendium of supporting information intended for informational purposes only. If you want to buy this website, please don't hesitate to contact us via e-mail: "d e n a c c 9 7 7 (at) g m a i l (dot) c o m" (delete spaces) or you can find and buy it on Afternic domain auctions.