SlideShare a Scribd company logo
1 of 8
DATAT TYPES IN C
E. BEENA Lr.IN COMPUTER SCIENCE
DATA TYPES
char
void
float
int
Data types specifies the set of values and the type of
data that can be stored in memory. The type of a
variable determines how much space it occupies in
storage and how the bit pattern stored is interpreted.
ANSI C support 3 classes of datatypes
1. Primary(or fundamental) datatypes
2. Derived datatypes
3. User defined datatypes
The Primary data types and their extensions are
discussed in this presentation
1. Primary Datatypes
i. Integer Types
ii. Floating point types
iii. Void types
iv. Character types
Primary
E. BEENA Lr.IN COMPUTER SCIENCE
E. BEENA Lr.IN COMPUTER SCIENCE
Integer data types
Type Storage size Value range
int (%d or %i ) 2 or 4 bytes
-32,768 to 32,767 or -2,147,483,648 to
2,147,483,647
unsigned int (%u) 2 or 4 bytes 0 to 65,535 or 0 to 4,294,967,295
short (%h) 1 or 2 bytes --128 to 127 or -32768 to 32767
unsigned short (%uh) 1 bytes 0 to 255
long (%ld) 4 bytes -2,147,483,648 to 2,147 ,483,647
unsigned long (%lu) 4 bytes 0 to 4,294,967,295
Short int
int
Long int
HOME
E. BEENA Lr.IN COMPUTER SCIENCE
Floating Point Type
Type Storage size Value range Precision
float (%f) 4 byte 1.2E-38 to
3.4E+38
6 decimal
places
double (%lf) 8 byte 2.3E-308 to
1.7E+308
15 decimal
places
long double (%L) 10 byte 3.4E-4932 to
1.1E+4932
19 decimal
places
long double
double
float
E. BEENA Lr.IN COMPUTER SCIENCE
void
• The void type has no values. This is usually used to specify the type of function.
It is used in three kinds of situations
• Function returns as void :There are various functions in C which do not return
any value or you can say they return void. A function with no return value has
the return type as void. For example, void exit (int status);
• Function arguments as void : There are various functions in C which do not
accept any parameter. A function with no parameter can accept a void.
For example: int rand(void);
• Pointers to void: A pointer of type void * represents the address of an object,
but not its type.
• For example: a memory allocation function void *malloc( size_t size ); returns a
pointer to void which can be casted to any data type.
E. BEENA Lr.IN COMPUTER SCIENCE
Character type (char)
Type Size(bytes) Range
char or signed char 1 -128 to 127
unsigned char 1 0 to 255
Character types are used to store characters value.
Size and range of char type on 16-bit machine
HOME
E. BEENA Lr.IN COMPUTER SCIENCE
E. BEENA Lr.IN COMPUTER SCIENCE

More Related Content

Similar to datatypes-200723165518 (1).pptx

data types in C programming
data types in C programmingdata types in C programming
data types in C programmingHarshita Yadav
 
DATATYPES,KEYWORDS,FORMATSPECS[1].pptx
DATATYPES,KEYWORDS,FORMATSPECS[1].pptxDATATYPES,KEYWORDS,FORMATSPECS[1].pptx
DATATYPES,KEYWORDS,FORMATSPECS[1].pptxLECO9
 
DATATYPES,KEYWORDS,FORMATSPECS[1].pptx
DATATYPES,KEYWORDS,FORMATSPECS[1].pptxDATATYPES,KEYWORDS,FORMATSPECS[1].pptx
DATATYPES,KEYWORDS,FORMATSPECS[1].pptxSKUP1
 
5-Lec - Datatypes.ppt
5-Lec - Datatypes.ppt5-Lec - Datatypes.ppt
5-Lec - Datatypes.pptAqeelAbbas94
 
Unit 1 Built in Data types in C language.ppt
Unit 1 Built in Data types in C language.pptUnit 1 Built in Data types in C language.ppt
Unit 1 Built in Data types in C language.pptpubgnewstate1620
 
Module 1:Introduction
Module 1:IntroductionModule 1:Introduction
Module 1:Introductionnikshaikh786
 
Constant, variables, data types
Constant, variables, data typesConstant, variables, data types
Constant, variables, data typesPratik Devmurari
 
Data types in C language
Data types in C languageData types in C language
Data types in C languagekashyap399
 
Programming construction tools
Programming construction toolsProgramming construction tools
Programming construction toolssunilchute1
 
Introduction to c++
Introduction to c++Introduction to c++
Introduction to c++NIDA HUSSAIN
 
C programming notes.pdf
C programming notes.pdfC programming notes.pdf
C programming notes.pdfAdiseshaK
 
Basic Data Types in C++
Basic Data Types in C++ Basic Data Types in C++
Basic Data Types in C++ Hridoy Bepari
 
Unit 5-hive data types – primitive and complex data
Unit 5-hive data types – primitive and complex dataUnit 5-hive data types – primitive and complex data
Unit 5-hive data types – primitive and complex datavishal choudhary
 

Similar to datatypes-200723165518 (1).pptx (20)

data types in C programming
data types in C programmingdata types in C programming
data types in C programming
 
DATATYPES,KEYWORDS,FORMATSPECS[1].pptx
DATATYPES,KEYWORDS,FORMATSPECS[1].pptxDATATYPES,KEYWORDS,FORMATSPECS[1].pptx
DATATYPES,KEYWORDS,FORMATSPECS[1].pptx
 
DATATYPES,KEYWORDS,FORMATSPECS[1].pptx
DATATYPES,KEYWORDS,FORMATSPECS[1].pptxDATATYPES,KEYWORDS,FORMATSPECS[1].pptx
DATATYPES,KEYWORDS,FORMATSPECS[1].pptx
 
5-Lec - Datatypes.ppt
5-Lec - Datatypes.ppt5-Lec - Datatypes.ppt
5-Lec - Datatypes.ppt
 
Unit 1 Built in Data types in C language.ppt
Unit 1 Built in Data types in C language.pptUnit 1 Built in Data types in C language.ppt
Unit 1 Built in Data types in C language.ppt
 
Module 1:Introduction
Module 1:IntroductionModule 1:Introduction
Module 1:Introduction
 
Constant, variables, data types
Constant, variables, data typesConstant, variables, data types
Constant, variables, data types
 
Data types in C language
Data types in C languageData types in C language
Data types in C language
 
C++ data types
C++ data typesC++ data types
C++ data types
 
Programming construction tools
Programming construction toolsProgramming construction tools
Programming construction tools
 
Data types
Data typesData types
Data types
 
Introduction to c++
Introduction to c++Introduction to c++
Introduction to c++
 
C programming notes
C programming notesC programming notes
C programming notes
 
C programming notes.pdf
C programming notes.pdfC programming notes.pdf
C programming notes.pdf
 
Data type
Data typeData type
Data type
 
Data Types In C
Data Types In CData Types In C
Data Types In C
 
Basic Data Types in C++
Basic Data Types in C++ Basic Data Types in C++
Basic Data Types in C++
 
Unit 5-hive data types – primitive and complex data
Unit 5-hive data types – primitive and complex dataUnit 5-hive data types – primitive and complex data
Unit 5-hive data types – primitive and complex data
 
PSPC--UNIT-2.pdf
PSPC--UNIT-2.pdfPSPC--UNIT-2.pdf
PSPC--UNIT-2.pdf
 
C#
C#C#
C#
 

More from NaniBhai3

resonanceinelectricalcircuitsseriesresonance-220309094034 (1).pdf
resonanceinelectricalcircuitsseriesresonance-220309094034 (1).pdfresonanceinelectricalcircuitsseriesresonance-220309094034 (1).pdf
resonanceinelectricalcircuitsseriesresonance-220309094034 (1).pdfNaniBhai3
 
g-04-160727172540 (1).pptx
g-04-160727172540 (1).pptxg-04-160727172540 (1).pptx
g-04-160727172540 (1).pptxNaniBhai3
 
Polarisation ppt.pptx
Polarisation ppt.pptxPolarisation ppt.pptx
Polarisation ppt.pptxNaniBhai3
 
chronology of indian mathematican.pptx
chronology of indian mathematican.pptxchronology of indian mathematican.pptx
chronology of indian mathematican.pptxNaniBhai3
 
mathematicsprojectfa-2-150820151303-lva1-app6892 (1).pptx
mathematicsprojectfa-2-150820151303-lva1-app6892 (1).pptxmathematicsprojectfa-2-150820151303-lva1-app6892 (1).pptx
mathematicsprojectfa-2-150820151303-lva1-app6892 (1).pptxNaniBhai3
 
ppt of maths 20..pptx
ppt of maths 20..pptxppt of maths 20..pptx
ppt of maths 20..pptxNaniBhai3
 

More from NaniBhai3 (6)

resonanceinelectricalcircuitsseriesresonance-220309094034 (1).pdf
resonanceinelectricalcircuitsseriesresonance-220309094034 (1).pdfresonanceinelectricalcircuitsseriesresonance-220309094034 (1).pdf
resonanceinelectricalcircuitsseriesresonance-220309094034 (1).pdf
 
g-04-160727172540 (1).pptx
g-04-160727172540 (1).pptxg-04-160727172540 (1).pptx
g-04-160727172540 (1).pptx
 
Polarisation ppt.pptx
Polarisation ppt.pptxPolarisation ppt.pptx
Polarisation ppt.pptx
 
chronology of indian mathematican.pptx
chronology of indian mathematican.pptxchronology of indian mathematican.pptx
chronology of indian mathematican.pptx
 
mathematicsprojectfa-2-150820151303-lva1-app6892 (1).pptx
mathematicsprojectfa-2-150820151303-lva1-app6892 (1).pptxmathematicsprojectfa-2-150820151303-lva1-app6892 (1).pptx
mathematicsprojectfa-2-150820151303-lva1-app6892 (1).pptx
 
ppt of maths 20..pptx
ppt of maths 20..pptxppt of maths 20..pptx
ppt of maths 20..pptx
 

Recently uploaded

Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...jaredbarbolino94
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxEyham Joco
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxAvyJaneVismanos
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersSabitha Banu
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementmkooblal
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfadityarao40181
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfSumit Tiwari
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxJiesonDelaCerna
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17Celine George
 

Recently uploaded (20)

Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptx
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptx
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginners
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of management
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdf
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
 
9953330565 Low Rate Call Girls In Rohini Delhi NCR
9953330565 Low Rate Call Girls In Rohini  Delhi NCR9953330565 Low Rate Call Girls In Rohini  Delhi NCR
9953330565 Low Rate Call Girls In Rohini Delhi NCR
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptx
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17
 

datatypes-200723165518 (1).pptx

  • 1. DATAT TYPES IN C E. BEENA Lr.IN COMPUTER SCIENCE
  • 2. DATA TYPES char void float int Data types specifies the set of values and the type of data that can be stored in memory. The type of a variable determines how much space it occupies in storage and how the bit pattern stored is interpreted. ANSI C support 3 classes of datatypes 1. Primary(or fundamental) datatypes 2. Derived datatypes 3. User defined datatypes The Primary data types and their extensions are discussed in this presentation 1. Primary Datatypes i. Integer Types ii. Floating point types iii. Void types iv. Character types Primary E. BEENA Lr.IN COMPUTER SCIENCE
  • 3. E. BEENA Lr.IN COMPUTER SCIENCE
  • 4. Integer data types Type Storage size Value range int (%d or %i ) 2 or 4 bytes -32,768 to 32,767 or -2,147,483,648 to 2,147,483,647 unsigned int (%u) 2 or 4 bytes 0 to 65,535 or 0 to 4,294,967,295 short (%h) 1 or 2 bytes --128 to 127 or -32768 to 32767 unsigned short (%uh) 1 bytes 0 to 255 long (%ld) 4 bytes -2,147,483,648 to 2,147 ,483,647 unsigned long (%lu) 4 bytes 0 to 4,294,967,295 Short int int Long int HOME E. BEENA Lr.IN COMPUTER SCIENCE
  • 5. Floating Point Type Type Storage size Value range Precision float (%f) 4 byte 1.2E-38 to 3.4E+38 6 decimal places double (%lf) 8 byte 2.3E-308 to 1.7E+308 15 decimal places long double (%L) 10 byte 3.4E-4932 to 1.1E+4932 19 decimal places long double double float E. BEENA Lr.IN COMPUTER SCIENCE
  • 6. void • The void type has no values. This is usually used to specify the type of function. It is used in three kinds of situations • Function returns as void :There are various functions in C which do not return any value or you can say they return void. A function with no return value has the return type as void. For example, void exit (int status); • Function arguments as void : There are various functions in C which do not accept any parameter. A function with no parameter can accept a void. For example: int rand(void); • Pointers to void: A pointer of type void * represents the address of an object, but not its type. • For example: a memory allocation function void *malloc( size_t size ); returns a pointer to void which can be casted to any data type. E. BEENA Lr.IN COMPUTER SCIENCE
  • 7. Character type (char) Type Size(bytes) Range char or signed char 1 -128 to 127 unsigned char 1 0 to 255 Character types are used to store characters value. Size and range of char type on 16-bit machine HOME E. BEENA Lr.IN COMPUTER SCIENCE
  • 8. E. BEENA Lr.IN COMPUTER SCIENCE