0% found this document useful (0 votes)
53 views32 pages

PPS Data Types 32slides Preet Yadav

The document provides an overview of data types in the C programming language, including basic, derived, and user-defined types. It explains the significance of data types, their classifications, and includes examples of each type along with their sizes and ranges. Additionally, the document discusses storage classes, practical usage, common errors, and references for further reading.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
53 views32 pages

PPS Data Types 32slides Preet Yadav

The document provides an overview of data types in the C programming language, including basic, derived, and user-defined types. It explains the significance of data types, their classifications, and includes examples of each type along with their sizes and ranges. Additionally, the document discusses storage classes, practical usage, common errors, and references for further reading.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 32

Title Slide

• Data Types in C Language


• PPS - Programming for Problem Solving
• Name: Preet Yadav
• Roll No: 2401440100032
• Section: A
Introduction to Data Types
• What is a Data Type?
• Why is it important in C?
Classification of Data Types
• 1. Basic
• 2. Derived
• 3. Enumeration
• 4. User Defined
Diagram here
Basic Data Types Overview
• int, float, char, double
int - Integer Data Type
• Used to store whole numbers.
• Example: int x = 10;

Diagram here
float - Floating Point
• Used for decimal values.
• Example: float pi = 3.14;

Diagram here
double - Precision Float
• Stores larger decimal values.
• Example: double val = 123.456;
char - Character Data Type
• Used to store characters.
• Example: char ch = 'A';

Diagram here
Size and Range Table
Data Type Size Range
int 4 bytes -2,147,483,648 to
2,147,483,647
float 4 bytes 3.4E-38 to 3.4E+38
double 8 bytes 1.7E-308 to 1.7E+308
char 1 byte -128 to 127
Signed vs Unsigned Types
• Signed: Can hold negative and positive.
• Unsigned: Only positive.

Diagram here
Modifiers
• short, long, signed, unsigned
short and long
• Example: short int x; long int y;
unsigned usage
• Example: unsigned int count = 100;
Derived Data Types
• Array
• Pointer
• Structure
• Union
Diagram here
Array
• Collection of same type elements.

Diagram here
Pointer
• Holds address of a variable.
Structure
• Used to combine different data types.
Union
• Similar to structure but memory shared.
User Defined Data Types
• typedef
• enum
typedef example
• typedef int marks;
• marks m1, m2;
enum example
• enum week {Mon, Tue};
Example Code
• #include <stdio.h>
• int main() {
• int x = 5;
• float y = 3.2;
• char z = 'A';
• printf("%d %f %c", x, y, z);
• return 0;
• }
Output Explanation
• Prints values of variables.
• Output: 5 3.200000 A
Diagram: Memory Representation

Diagram here
Storage Classes
• auto, static, extern, register
auto and register
• Default storage classes.
static and extern
• Used for memory persistence and linkage.
Practical Use of Data Types
• Choose data types based on use case.
Common Errors
• Mismatch of type
• Overflow or Underflow
Summary
• Data Types are core part of C
• Use wisely for efficiency
References
• Let Us C – Yashwant Kanetkar
• AKTU Syllabus
• TutorialsPoint
Thank You
• Any Questions? 🙏

You might also like