Professional Documents
Culture Documents
• Identifiers
• Constants
• Variable
Today class…
• Data types
• Variable Declaration
Data
1. Numbers
Data: Examples
2. Letters
Data: Examples
4. Audio or video
Data Items…….
• Section - character
• Branch - string
• Name - string
• Age - integer
• Height - floating-point
• Weight - floating-point
• Cost - floating-point
• Rupees - integer
• Temperature - floating-point
• Sum - integer
Data Items…….
• DOB - string
• Address - string
• Student ID - Integer or string
• Marks - integer
• Average - floating-point
• Rate of Interest - floating-point
• Radius - floating-point
• Gender - string
Data Types
• Data type or just type.
1. Character (char)
2. Integer (int)
3. Single-Precision Floating Point (float)
4. Double-Precision Floating Point (double)
5. No value available (void)
2. Derived Data Types
• These data types are derived from the basic data types.
• Derived data types available in C are:
1. Arrays
2. Pointers
3. Functions
3. User-Defined Data Types
1. Structures (struct)
2. Union (union)
3. Enumeration (enum)
4. Typedef (typedef)
1. Basic Data Types ( Primitive Data Types )
1. Character (char)
2. Integer (int)
3. Single-Precision Floating Point (float)
4. Double-Precision Floating Point (double)
5. No value available (void)
Character (char)
Example:
main()
{
char a;
a = ‘y’;
----
}
Integer (int)
Example:
main()
{
int a;
a = 123;
----
}
Single-Precision Floating Point (float)
• It is used to define the floating point values with precision 6.
• Size: 4 Byte
• Range: 3.4 * 10-38 to 3.4 * 1038
• Format Specifier: %f
Example:
main()
{
float a;
a = 1.23;
----
}
Double-Precision Floating Point (double)
• It is used to define the floating point values with precision 14.
• Size: 8 Byte
• Range: 1.7 * 10-308 to 1.7 * 10308
• Format Specifier: %lf
Example:
main()
{
double a;
a = 1.23565656;
----
}
Variable Declaration
Ans:
To reserve the amount of memory
space in RAM
What is the purpose of Reserve the Amount of Memory
Space in RAM
Ans:
• To store the values.
Fridge
• To store value in RAM,
What should we do?
Ans: To reserve the space in RAM.
datatype variable_name;
Ex: int a;
datatype variable_list;