SlideShare a Scribd company logo
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

cassignmentii-170424105623.pdf
cassignmentii-170424105623.pdfcassignmentii-170424105623.pdf
cassignmentii-170424105623.pdf
YRABHI
 
DATATYPES,KEYWORDS,FORMATSPECS[1].pptx
DATATYPES,KEYWORDS,FORMATSPECS[1].pptxDATATYPES,KEYWORDS,FORMATSPECS[1].pptx
DATATYPES,KEYWORDS,FORMATSPECS[1].pptx
LECO9
 
DATATYPES,KEYWORDS,FORMATSPECS[1].pptx
DATATYPES,KEYWORDS,FORMATSPECS[1].pptxDATATYPES,KEYWORDS,FORMATSPECS[1].pptx
DATATYPES,KEYWORDS,FORMATSPECS[1].pptx
SKUP1
 
5-Lec - Datatypes.ppt
5-Lec - Datatypes.ppt5-Lec - Datatypes.ppt
5-Lec - Datatypes.ppt
AqeelAbbas94
 
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
pubgnewstate1620
 
Module 1:Introduction
Module 1:IntroductionModule 1:Introduction
Module 1:Introduction
nikshaikh786
 
Constant, variables, data types
Constant, variables, data typesConstant, variables, data types
Constant, variables, data types
Pratik Devmurari
 
Data types in C language
Data types in C languageData types in C language
Data types in C language
kashyap399
 
Programming construction tools
Programming construction toolsProgramming construction tools
Programming construction tools
sunilchute1
 
Data types
Data typesData types
Data types
Syed Umair
 
Introduction to c++
Introduction to c++Introduction to c++
Introduction to c++
NIDA HUSSAIN
 
C programming notes
C programming notesC programming notes
C programming notes
Prof. Dr. K. Adisesha
 
C programming notes.pdf
C programming notes.pdfC programming notes.pdf
C programming notes.pdf
AdiseshaK
 
Data type
Data typeData type
Data Types In C
Data Types In CData Types In C
Data Types In C
Simplilearn
 
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 data
vishal choudhary
 
PSPC--UNIT-2.pdf
PSPC--UNIT-2.pdfPSPC--UNIT-2.pdf
PSPC--UNIT-2.pdf
ArshiniGubbala3
 
C#
C#C#

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

cassignmentii-170424105623.pdf
cassignmentii-170424105623.pdfcassignmentii-170424105623.pdf
cassignmentii-170424105623.pdf
 
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).pdf
NaniBhai3
 
g-04-160727172540 (1).pptx
g-04-160727172540 (1).pptxg-04-160727172540 (1).pptx
g-04-160727172540 (1).pptx
NaniBhai3
 
Polarisation ppt.pptx
Polarisation ppt.pptxPolarisation ppt.pptx
Polarisation ppt.pptx
NaniBhai3
 
chronology of indian mathematican.pptx
chronology of indian mathematican.pptxchronology of indian mathematican.pptx
chronology of indian mathematican.pptx
NaniBhai3
 
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
NaniBhai3
 
ppt of maths 20..pptx
ppt of maths 20..pptxppt of maths 20..pptx
ppt of maths 20..pptx
NaniBhai3
 

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

Normal Labour/ Stages of Labour/ Mechanism of Labour
Normal Labour/ Stages of Labour/ Mechanism of LabourNormal Labour/ Stages of Labour/ Mechanism of Labour
Normal Labour/ Stages of Labour/ Mechanism of Labour
Wasim Ak
 
Multithreading_in_C++ - std::thread, race condition
Multithreading_in_C++ - std::thread, race conditionMultithreading_in_C++ - std::thread, race condition
Multithreading_in_C++ - std::thread, race condition
Mohammed Sikander
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
Levi Shapiro
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
Peter Windle
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
Atul Kumar Singh
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
Delapenabediema
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
MysoreMuleSoftMeetup
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
Tamralipta Mahavidyalaya
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
EugeneSaldivar
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
TechSoup
 
Embracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic ImperativeEmbracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic Imperative
Peter Windle
 
STRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBC
STRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBCSTRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBC
STRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBC
kimdan468
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
EverAndrsGuerraGuerr
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
Jisc
 
Marketing internship report file for MBA
Marketing internship report file for MBAMarketing internship report file for MBA
Marketing internship report file for MBA
gb193092
 
Chapter -12, Antibiotics (One Page Notes).pdf
Chapter -12, Antibiotics (One Page Notes).pdfChapter -12, Antibiotics (One Page Notes).pdf
Chapter -12, Antibiotics (One Page Notes).pdf
Kartik Tiwari
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
Sandy Millin
 
S1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptxS1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptx
tarandeep35
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
Celine George
 

Recently uploaded (20)

Normal Labour/ Stages of Labour/ Mechanism of Labour
Normal Labour/ Stages of Labour/ Mechanism of LabourNormal Labour/ Stages of Labour/ Mechanism of Labour
Normal Labour/ Stages of Labour/ Mechanism of Labour
 
Multithreading_in_C++ - std::thread, race condition
Multithreading_in_C++ - std::thread, race conditionMultithreading_in_C++ - std::thread, race condition
Multithreading_in_C++ - std::thread, race condition
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
 
Embracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic ImperativeEmbracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic Imperative
 
STRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBC
STRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBCSTRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBC
STRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBC
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
 
Marketing internship report file for MBA
Marketing internship report file for MBAMarketing internship report file for MBA
Marketing internship report file for MBA
 
Chapter -12, Antibiotics (One Page Notes).pdf
Chapter -12, Antibiotics (One Page Notes).pdfChapter -12, Antibiotics (One Page Notes).pdf
Chapter -12, Antibiotics (One Page Notes).pdf
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
 
S1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptxS1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptx
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
 

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