Thursday, 30 January 2014

variable In Programing Langauge

In C langauge Variables

Variables is a memory locations in C programming language.
  • We use variables to store data in memory for later use, and that values can be change.
  • Values of the variables can be numeric or alphabetic.

There are some rules on choosing variable names

  • Variable name can consist of Capital letters A-Z, lowercase letters a-z, digits 0-9, and the underscore character.
  • The first character must be a letter or underscore.
  • Blank spaces cannot be used in variable names.
  • Special characters like #, $ are not allowed.
  • C keywords can not be used as variable names.
  • Variable names are case sensitive.

Variable Definition in C

Syntax:
type variable_name;

type variable_name, variable_name, variable_name;


Example:

/* variable definition and initialization */
int width, height=5;
char letter='A';
float age, area;
double d;

/* actual initialization */
width = 10;
age = 26.5;

0 comments:

Post a Comment