Monday, 8 June 2015

different types of c variables

Types of  C Variables 


Definition  of Variables : An entity that  may vary during program execution is called a "variable". 

Variables location in c : Variable names are given to locations in memory. These locations can be 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.

Because , a particular type of variable can hold only the same type of constant.

Rules for variable names

  1. Variable name is any combination of 1 to 31 alphabets, digits or Underscores. Some compilers allow variable names whose length could be up to 247 character.Still , it would be safer to stick to the rule of 31 characters. don't create unnecessarily long variable names  (Typing effort ) .
  2. The first character in the in the variable name must be an alphabet or underscore.
  3. no commas or blanks are allowed with in a variable name.
  4. no special symbols other than an underscore ( people_sal ) can be used in a variable name.

These same rules for all type of primary and secondary variables.

Example For Variables in c Program Using Formats

int a,b,c;
int si,m_hra;
float a;
char code;

Since , The maximum length of a variable name using in 31 characters in c programming language.

if We want to calculate simple interest , it is always advisable to construct meaning full variable names like sum, temp to represent principle , most of the users like type in this types of variables ( a,b,c ). 



alltechprograms

No comments:

Post a Comment