Now you can Subscribe using RSS

Submit your Email

22 February 2016

Variable in c programming

LAKS Tutorials
we learn comments in c language. Here we learn variables in c language. Before that we know all about any thing we can store we use always third party (thing) means if we want to store water for our drinking we use one water bottle,if we want to store latest songs in our mobile we use memory card like that we are depended on other thing.For storing or replacing in real time. For that we have different names and different thins like bottle etc.In the same way C language named as variable
variables in c

What is variable in C Language ?


Variable in C programming is also called as container to store the data. A variable is a name given to the memory location where the actual data is stored. Variables are so called because, the constants in the variables can be modified any where in the program values of variables varies from time to time.

Variable naming Rules


We have to follow the following rules while creating a variables in C programming.

  • Variable name should start with an alphabet.
    Ex: a,anand,num,sum
  • Variable name cane be sequence of alphabets and digits.
    Ex: abc,anand12,sum34;
  • Variable name can't contain any special characters expect such as[ *,^, ! , ; , #,...etc]
    EX: rool.no=101; // incorrect declaration should not contain special character(.)
  • Variable name should not contain spaces.Underscores are allowed to Different between two words.
    EX: sales no=420; incorrect statement because space are not allowed; sales_no=420; correct statement;

Rember Following Tricks


  1. Do not create Unnecessarily long variable name.
  2. Do not use Underscore as a First Character to avoid confusion between System variables and User Defined variables because many system variables are start with Underscore.
  3. Variable names are case sensitive.

Declaration of variable

Declare is nothing bur represent a variable. Only Datatype and Variable name is represented in Declaration. When we declare a variable following instructions will be done.
  1. Memory is allocated for variable or space is reserved for variable.
  2. Declaration is used for just identification of Datatype.

Example of Declaration

int ivar; float fvar; char cvar;

LAKS Tutorials / Author & Editor

RAM.P is Founder of the LAKS TUTORIAL.The Main AIM of the author is providing basics to the beginners of the program to imrove their knwoledge

7 comments:

  1. Pretty post, I hope your site useful for many users who want to learn basics of programming to enhance their skill for getting good career in IT, thanks for taking time to discuss about fundamental programming niche.
    With Regards,

    Python Training in Chennai|Python Training|Python Training in Chennai

    ReplyDelete
  2. This blog awesome and i learn a lot about programming from here.The best thing about this blog is that you doing from beginning to experts level.

    Love from

    ReplyDelete
  3. Hi, I have read your blog. Really very informative and excellent post I had ever seen about C. Thank you for sharing such a wonderful blog to our vision.
    Python Training in Chennai|Web Designing Training in Chennai|Java Training in chennai

    ReplyDelete
  4. Thanks for this nice blog. It was really very nice to read the blog. Thanks a lot! You made a new blog entry to answer my question; I really appreciate your time and effort.
    java training in chennai |
    Core java training in chennai

    ReplyDelete

Coprights @ 2016, Blogger Templates Designed By Templateism | Templatelib