Earn while u Learn

Tips tweaks hacks on computer with C C++ VB tutorials and ways to earn money online

ad

Variable Declaration in C

The rules for constructing variables remain same for all type of variables: integer,real, character, string variable etc.
Ex: int x,y;
      float avg, div;
Variable Initialization
Variables can be initialized by placing an equal= sign an a constant after the name of variable. You can give most variables in C, a value at the same time when they were declared.
Syntax:
Data type variable name = constant;
    Ex: int c=20;
          char name="a2zhacks.blogspot.com";

Types of variables:
1.  local variable: Variables that are declared inside a function are called Local variables.
2.  global variables: Variables that are declared before the main() function. They known throughout the program.

0 comments:

Sign in / Join

Labels