4Character Sets and Constants in C Language
The character set in C has all alphabets, digits, facial symbols, and additional ASCII
characters. Constants in C language are of two types - primary constants and secondary
constants. Primary constants in C are integer, real, and character.
Basic Data Types in C
The three basic data types in C are int, float, and char. Int is used to store whole numbers,
while float is used to store real values or values that contain decimal points. Char is used to
store characters.
Variables in C Language
Variables in C are used to store values that the user has entered or values that we have
calculated and stored the results into those variables to display output to the user. While
declaring variables, it is essential to give them names that indicate what value they store.
Variables in C
Variables in C are used to store values for later use in the program. It is important to assign
a value to the variable at the time of declaration to avoid logical errors. Variables should not
contain special characters except for underscore and must start with an alphabet or
underscore. Keywords such as int, float, and char cannot be used as variable names.
Valid variable names: x, roll_number, value_super_cool
Invalid variable names: 0x, if, int
Declaring Variables
To declare a variable in C, we must first write the datatype. Examples of datatypes are int,
float, and char. We can also initialize the variable using the equals operator.
When a variable is declared, the compiler allocates memory to the variable and assigns it an
address location. If the variable is not initialized, it will hold a random value.
Operators in C
C language has a variety of operators, including assignment operators such as =, +=, and
-=. Arithmetic operators such as +, -, *, /, and % are also available.
Escape Sequences
Escape sequences are used in C to print special characters such as double quotes and
slashes. Examples of escape sequences include \n for newline and \t for tab.
Decision Control Structure
Decision control structures in C are used when a program has to make a decision based on
a condition. An if statement is used to execute a set of instructions if the condition is true,
and an else statement is used to execute a set of instructions if the condition is false.
The character set in C has all alphabets, digits, facial symbols, and additional ASCII
characters. Constants in C language are of two types - primary constants and secondary
constants. Primary constants in C are integer, real, and character.
Basic Data Types in C
The three basic data types in C are int, float, and char. Int is used to store whole numbers,
while float is used to store real values or values that contain decimal points. Char is used to
store characters.
Variables in C Language
Variables in C are used to store values that the user has entered or values that we have
calculated and stored the results into those variables to display output to the user. While
declaring variables, it is essential to give them names that indicate what value they store.
Variables in C
Variables in C are used to store values for later use in the program. It is important to assign
a value to the variable at the time of declaration to avoid logical errors. Variables should not
contain special characters except for underscore and must start with an alphabet or
underscore. Keywords such as int, float, and char cannot be used as variable names.
Valid variable names: x, roll_number, value_super_cool
Invalid variable names: 0x, if, int
Declaring Variables
To declare a variable in C, we must first write the datatype. Examples of datatypes are int,
float, and char. We can also initialize the variable using the equals operator.
When a variable is declared, the compiler allocates memory to the variable and assigns it an
address location. If the variable is not initialized, it will hold a random value.
Operators in C
C language has a variety of operators, including assignment operators such as =, +=, and
-=. Arithmetic operators such as +, -, *, /, and % are also available.
Escape Sequences
Escape sequences are used in C to print special characters such as double quotes and
slashes. Examples of escape sequences include \n for newline and \t for tab.
Decision Control Structure
Decision control structures in C are used when a program has to make a decision based on
a condition. An if statement is used to execute a set of instructions if the condition is true,
and an else statement is used to execute a set of instructions if the condition is false.