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.
Showing posts with label Variable Declaration in C. Show all posts
Showing posts with label Variable Declaration in C. Show all posts
Subscribe to:
Posts (Atom)
