what is variable in C?- Day2

what is variable in C?

variables:

A name given to the memory location.

Variable is used to get the stored values easily into our program.

The names could be a, car_number, num1 etc...

Rules of variable names:

1. names should not match with any pre defined names.

2. should not contain any spaces in between the names, u can use underscore(_) instead. 

3. variable name can be of any length but should not contain any special characters.

4. Name can be of alpha-numeric, but should not start with numbers. 

Global Variables: These variables are declared and used throughout the program, which means they dont have a limit and range.

Local Variables: These variables have limits and range because they are declared and used inside a function only.

There are some rules is there to give the variable name
  1. It can be alpha numeric but it should not start wit a number.
eg:
         valid:   int number1;
                    float avgmarks7;
                    char name;
   
       invalid:   int 7marks;

    2.It should not be a keyword.
  Eg:
          char float;
          int default;
    3.Should not use any special symbols except underscore(_).
  Eg:
     invalid:   int name@;
     valid:        char roll_number;