Programming, Music, Games. Creation.

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

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