Programming, Music, Games. Creation.

Posts tagged “important

Two Things to be Aware when you Declare a Variable

1. INTRODUCE FIRST

int main(void)
{
   int a;//declare
   int b;//declare

   a=5;//input
   b=1;//input

printf(“%d + %d = %d\n”, a, b, a+b);
return 0;
}

CORRECT :)

int main(void)
{
int a;//declare
   a=5;//input
   int b;//declare
   b=1;//input

printf(“%d + %d = %d\n”, a, b, a+b);
return 0;
}

WRONG :(

————————————————–

2. NAME IT PROPERLY

3 SIMPLE things! :D

1. Variables consist of Alphabets, Numbers and Underscore(_)

2. C Language differentiates  small letters and CAPITAL LETTERS :D
Therefore val and Val are different variables :)

3. Variable CANNOT start with a Numb3r or be a Key Word! It should also not contain any Space or Special Letters