Variables In C Language


An entity that may vary during program execution is called a ‘Variable’. Variables names are names given to locations in memory. These locations can contain integer, real or character constants. In any language, the types of variables that it can support depends on the types of constants that it can handle. Variable names are just symbolic representation of the memory location. For Example :

int num;

Here, num is the variable of integer type.

Rules for Constructing variable Names in C :

  • A variable name is any combination of 1 to 31 alphabets, digits or underscore (_).
  • The first character in the variable name must be an alphabet or underscore.
  • No commas and blanks are allowed within a variable name.
  • No special symbol except underscore can be used in a variable name.

In C Programming, you have to declare the variable before using it in the program.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s