Pages

Thursday, July 30, 2020

HOW TO DECLARE A VARIABLES IN C


Variables are run time entities and these are used to hold temporary data at program run time. 
In C, Every variable declare with a predefined data type.

RULES FOR NAMING VARIABLE
RULE 1: Variable name cannot declare with a reserved keyword.

EXAMPLES
int void (wrong declaration)
int void1 (correct declaration)


RULE 2: Variable does not contain any blank space.

EXAMPLES
int a bc (wrong declaration)
int a_bc (Correct declaration)


RULE 3: Variable name should not start with a number.

EXAMPLES
int 2abc (wrong declaration)
int a123 (correct declaration)


RULE 4: Two variables cannot declare with same name.

EXAMPLES
int a, a; (wrong declaration)
int a, b; (Correct declaration)

                                PROGRAM TO SWAPPING VALUES >>

No comments:

Post a Comment