If you have any query feel free to chat us!
Happy Coding! Happy Learning!
In C, a variable is a named location in memory that can be used to store a value. Variables have a specific data type, such as int, float, or char, which determines the size and range of values that can be stored. The data type also determines the set of operations that can be performed on the variable.
To declare a variable in C, you use the following syntax:
Copy code
data_type variable_name;
For example:
Copy code
int age;
float weight;
char grade;
You can also initialize a variable when you declare it by assigning a value to it.
Copy code
int age = 25;
float weight = 68.5;
char grade = 'A';
C is a statically-typed language, which means that the data type of a variable must be specified when it is declared and cannot be changed later. This means that you cannot assign a value of a different data type to a variable after it has been declared.
C also supports several data types that are derived from the basic data types. These include:
Comments: 0