Code Point Blog
Iam presenting here ,all type of knowledge if you want to interest knowing about any topic then click below thumbnail view button and knowing.
1.Variable Declaration :Before using a variable in C, you need to declare it with a specific data type. The syntax for declaring a variable is as follows:
data_type variable_name;
For example:
int age; ( Integer variable to store age )
float salary; ( Floating-point variable to store salary )
char grade; ( Character variable to store grade )
2.Variable Initialization :Variables can be initialized (assigned an initial value) at the time of declaration or later in the program.
int score = 100; ( Initialized at declaration ) float temperature; ( Declaration without initialization ) temperature = 25.5; ( Initialized later in the program ) char firstInitial = 'J'; ( Initialized at declaration with a character value )
3.Naming Rules for Variables :
The name of a variable must begin with a letter (uppercase or lowercase) or an underscore `_`.
After the first character, a variable name can contain letters, digits, and underscores.
C is case-sensitive, so `score` and `Score` are considered two different variables.
4.Variable Usage :
Once a variable is declared and, if needed, initialized, it can be used throughout the program to store and retrieve data.
int x = 5;
int y = 10;
int sum = x + y; ( The 'sum' variable stores the result of the addition of 'x' and 'y' )
Variables are widely used in C programming and are essential for performing calculations, storing user input, and other operations.