SlideShare a Scribd company logo
1 of 16
DataTypes in ‘C’
By: Satveer Kaur, Assistant Professor, Khalsa College, Patiala 1
DataType
Is the description of nature of data.
Data can be in numeric form(integer
or real) or in character form(single
character or string).
By: Satveer Kaur, Assistant Professor, Khalsa College, Patiala 2
Types of Data
type
Primary(or fundamental)
data types
Derived data types
User-defined data types
By: Satveer Kaur, Assistant Professor, Khalsa College, Patiala 3
Primary data
types
Primary
data type
Integer
types
Floating
point types
Character
types
Void types
By: Satveer Kaur, Assistant Professor, Khalsa College, Patiala 4
Integer types
signed
unsigned
• int
• short int
• long int
• unsigned int
• unsigned short
int
• unsigned long
int
By: Satveer Kaur, Assistant Professor, Khalsa College, Patiala 5
Integer types
• Size = 2 byte(16 bit)
• Range -32768 to 32767int or signed int
• Size = 1 byte (8 bit)
• Range -128 to 127
short int or
signed short int
• Size = 4 byte (32 bit)
• Range -2,147,483,648 to
2,147,483,647
long int or
signed long int
By: Satveer Kaur, Assistant Professor, Khalsa College, Patiala 6
Integer types
• Size = 2 byte (16 bit)
• Range 0 to 65535
unsigned
int
• Size = 1 byte (8 bit)
• Range = 0 to 255
unsigned
short int
• Size = 4 byte (32 bit)
• Range = 0 to 4,294,967,295
unsigned
long int
By: Satveer Kaur, Assistant Professor, Khalsa College, Patiala 7
Floating point
types
float
• Size = 4 byte (32 bit)
• Range 3.4E-38 to 3.4E+38
double
• Size = 8 byte (64 bit)
• Range is 1.7E-308 to 1.7E+308
long double
• Size = 10 byte (80 bit)
• Range 3.4E-4932 to 3.4E+4932
By: Satveer Kaur, Assistant Professor, Khalsa College, Patiala 8
Character
types
char or signed char
•Size = 1 byte (8 bit)
•Range -128 to 127
unsigned char
•Size = 1 byte (8 bit)
•Range 0 to 255
By: Satveer Kaur, Assistant Professor, Khalsa College, Patiala 9
Void types
void type has no values
Used to specify the type of functions
Also plays the role of generic type
By: Satveer Kaur, Assistant Professor, Khalsa College, Patiala 10
Data types and
their keywords
Data type Equivalent keyword
Character char
Unsigned character unsigned char
Signed character signed char
Signed integer signed int (or int)
Signed short integer signed short int (or short int or short)
Signed long integer signed long int (or long int or long)
Unsigned integer unsigned int (or unsigned)
Unsigned short integer unsigned short int (or unsigned short)
Unsigned long integer unsigned long int (or unsigned long)
Floating point float
Double-precision floating point double
Extended double precision floating
point
long double
By: Satveer Kaur, Assistant Professor, Khalsa College, Patiala 11
Derived data
types
 Are derived from primary data types.
By: Satveer Kaur, Assistant Professor, Khalsa College, Patiala 12
• Sequence of data items having
homogenous values.
• Values are stored in adjacent locations.
Array
• Function pointers allow reference to the
functions with a particular signature.References
• Are used to access the memory locations
• And deal with the addresses of variables.Pointers
User-defined
data types
 ‘Type definition’ – a feature of ‘C’ allows the programmers to
define their own identifiers to represent an existing data.
By: Satveer Kaur, Assistant Professor, Khalsa College, Patiala 13
• a package of variables of different types under
a single name.
• To define a structure, ‘struct’ keyword is used.
Structure
• allow storage of various data types in the same
memory location.
• can defined with different members, but only a single
member can contain a value at a given time.
• To define a union, ‘union’ keyword is used.
Union
• a special data type that consists of integral
constants, and each of them is assigned with a
specific name.
• To define an enumeration, ‘enum’ keyword is
used.
Enumeration
Declaring
primary data
types with
variable names
int age;
char letter;
float height, width;
By: Satveer Kaur, Assistant Professor, Khalsa College, Patiala 14
Examples
 #include <stdio.h>
 int main()
 {
 int a = 400; // positive integer data type
 float b = 5.2974; // float data type
 char c = ‘A'; // char data type
 long d = 42357; // long positive integer data type
 long e = -41756; // long -ve integer data type
 int f = -167; // -ve integer data type
 short g = 330; // short +ve integer data type
 short h = -830; // short -ve integer data type
 double i = 7.1987654320; // double float data type
 float j = -5.95; // float data type
 }
By: Satveer Kaur, Assistant Professor, Khalsa College, Patiala 15
ThankYou
By: Satveer Kaur, Assistant Professor, Khalsa College, Patiala 16

More Related Content

What's hot

arrays and pointers
arrays and pointersarrays and pointers
arrays and pointersSamiksha Pun
 
Variables in C Programming
Variables in C ProgrammingVariables in C Programming
Variables in C Programmingprogramming9
 
Keywords in c language
Keywords in c languageKeywords in c language
Keywords in c languageJoydeep16
 
Union in c language
Union  in c languageUnion  in c language
Union in c languagetanmaymodi4
 
Features of c language 1
Features of c language 1Features of c language 1
Features of c language 1srmohan06
 
Data Types and Variables In C Programming
Data Types and Variables In C ProgrammingData Types and Variables In C Programming
Data Types and Variables In C ProgrammingKamal Acharya
 
Pointers in c - Mohammad Salman
Pointers in c - Mohammad SalmanPointers in c - Mohammad Salman
Pointers in c - Mohammad SalmanMohammadSalman129
 
Data Type in C Programming
Data Type in C ProgrammingData Type in C Programming
Data Type in C ProgrammingQazi Shahzad Ali
 
Data types in C language
Data types in C languageData types in C language
Data types in C languagekashyap399
 
Function in C Programming
Function in C ProgrammingFunction in C Programming
Function in C ProgrammingAnil Pokhrel
 
Operators in C Programming
Operators in C ProgrammingOperators in C Programming
Operators in C Programmingprogramming9
 
Enumerated data types in C
Enumerated data types in CEnumerated data types in C
Enumerated data types in CArpana shree
 
Array in c programming
Array in c programmingArray in c programming
Array in c programmingMazharul Islam
 

What's hot (20)

arrays and pointers
arrays and pointersarrays and pointers
arrays and pointers
 
Variables in C Programming
Variables in C ProgrammingVariables in C Programming
Variables in C Programming
 
C tokens
C tokensC tokens
C tokens
 
Data types
Data typesData types
Data types
 
Keywords in c language
Keywords in c languageKeywords in c language
Keywords in c language
 
Union in c language
Union  in c languageUnion  in c language
Union in c language
 
C Tokens
C TokensC Tokens
C Tokens
 
Features of c language 1
Features of c language 1Features of c language 1
Features of c language 1
 
Data Types and Variables In C Programming
Data Types and Variables In C ProgrammingData Types and Variables In C Programming
Data Types and Variables In C Programming
 
Pointers in c - Mohammad Salman
Pointers in c - Mohammad SalmanPointers in c - Mohammad Salman
Pointers in c - Mohammad Salman
 
Data Type in C Programming
Data Type in C ProgrammingData Type in C Programming
Data Type in C Programming
 
Data types in C language
Data types in C languageData types in C language
Data types in C language
 
Arrays and Strings
Arrays and Strings Arrays and Strings
Arrays and Strings
 
Function in C Programming
Function in C ProgrammingFunction in C Programming
Function in C Programming
 
[OOP - Lec 07] Access Specifiers
[OOP - Lec 07] Access Specifiers[OOP - Lec 07] Access Specifiers
[OOP - Lec 07] Access Specifiers
 
Programming in c Arrays
Programming in c ArraysProgramming in c Arrays
Programming in c Arrays
 
Operators in C Programming
Operators in C ProgrammingOperators in C Programming
Operators in C Programming
 
Enumerated data types in C
Enumerated data types in CEnumerated data types in C
Enumerated data types in C
 
Arrays Basics
Arrays BasicsArrays Basics
Arrays Basics
 
Array in c programming
Array in c programmingArray in c programming
Array in c programming
 

Similar to C Data Types Guide

Similar to C Data Types Guide (20)

Data type
Data typeData type
Data type
 
Variables in C
Variables in CVariables in C
Variables in C
 
Lect5
Lect5Lect5
Lect5
 
Chapter 4.pptx
Chapter 4.pptxChapter 4.pptx
Chapter 4.pptx
 
basics-of-python-programming3.pptx
basics-of-python-programming3.pptxbasics-of-python-programming3.pptx
basics-of-python-programming3.pptx
 
keywords and identifiers
 keywords and identifiers keywords and identifiers
keywords and identifiers
 
Data Types in C language
Data Types in C languageData Types in C language
Data Types in C language
 
L2 datatypes and variables
L2 datatypes and variablesL2 datatypes and variables
L2 datatypes and variables
 
01 Java Language And OOP PART I
01 Java Language And OOP PART I01 Java Language And OOP PART I
01 Java Language And OOP PART I
 
OOP-java-variables.pptx
OOP-java-variables.pptxOOP-java-variables.pptx
OOP-java-variables.pptx
 
PROGRAMMING IN C
PROGRAMMING IN C PROGRAMMING IN C
PROGRAMMING IN C
 
358 33 powerpoint-slides_7-structures_chapter-7
358 33 powerpoint-slides_7-structures_chapter-7358 33 powerpoint-slides_7-structures_chapter-7
358 33 powerpoint-slides_7-structures_chapter-7
 
Welcome
WelcomeWelcome
Welcome
 
Data Handling
Data HandlingData Handling
Data Handling
 
1. structure
1. structure1. structure
1. structure
 
Structure in C
Structure in CStructure in C
Structure in C
 
CSC111-Chap_02.pdf
CSC111-Chap_02.pdfCSC111-Chap_02.pdf
CSC111-Chap_02.pdf
 
enum_namespace.ppt
enum_namespace.pptenum_namespace.ppt
enum_namespace.ppt
 
C language basics
C language basicsC language basics
C language basics
 
3. Data types and Variables
3. Data types and Variables3. Data types and Variables
3. Data types and Variables
 

More from Satveer Mann

Operators and expressons
Operators and expressonsOperators and expressons
Operators and expressonsSatveer Mann
 
Preprocessor directives
Preprocessor directivesPreprocessor directives
Preprocessor directivesSatveer Mann
 
Program structure of c
Program structure of cProgram structure of c
Program structure of cSatveer Mann
 
Algorithms, flow charts and pseudocodes
Algorithms, flow charts and pseudocodesAlgorithms, flow charts and pseudocodes
Algorithms, flow charts and pseudocodesSatveer Mann
 
Problem solving process
Problem solving processProblem solving process
Problem solving processSatveer Mann
 
Character set in C
Character set in CCharacter set in C
Character set in CSatveer Mann
 
Introduction to c
 Introduction to c Introduction to c
Introduction to cSatveer Mann
 

More from Satveer Mann (8)

Operators and expressons
Operators and expressonsOperators and expressons
Operators and expressons
 
Constants in C
Constants in CConstants in C
Constants in C
 
Preprocessor directives
Preprocessor directivesPreprocessor directives
Preprocessor directives
 
Program structure of c
Program structure of cProgram structure of c
Program structure of c
 
Algorithms, flow charts and pseudocodes
Algorithms, flow charts and pseudocodesAlgorithms, flow charts and pseudocodes
Algorithms, flow charts and pseudocodes
 
Problem solving process
Problem solving processProblem solving process
Problem solving process
 
Character set in C
Character set in CCharacter set in C
Character set in C
 
Introduction to c
 Introduction to c Introduction to c
Introduction to c
 

Recently uploaded

Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxRoyAbrique
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
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
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...M56BOOKSTORE PRODUCT/SERVICE
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Concept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfConcept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfUmakantAnnand
 
MENTAL STATUS EXAMINATION format.docx
MENTAL     STATUS EXAMINATION format.docxMENTAL     STATUS EXAMINATION format.docx
MENTAL STATUS EXAMINATION format.docxPoojaSen20
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppCeline George
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
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
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application ) Sakshi Ghasle
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 

Recently uploaded (20)

Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
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
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Concept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfConcept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.Compdf
 
MENTAL STATUS EXAMINATION format.docx
MENTAL     STATUS EXAMINATION format.docxMENTAL     STATUS EXAMINATION format.docx
MENTAL STATUS EXAMINATION format.docx
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website App
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
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
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application )
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 

C Data Types Guide

  • 1. DataTypes in ‘C’ By: Satveer Kaur, Assistant Professor, Khalsa College, Patiala 1
  • 2. DataType Is the description of nature of data. Data can be in numeric form(integer or real) or in character form(single character or string). By: Satveer Kaur, Assistant Professor, Khalsa College, Patiala 2
  • 3. Types of Data type Primary(or fundamental) data types Derived data types User-defined data types By: Satveer Kaur, Assistant Professor, Khalsa College, Patiala 3
  • 4. Primary data types Primary data type Integer types Floating point types Character types Void types By: Satveer Kaur, Assistant Professor, Khalsa College, Patiala 4
  • 5. Integer types signed unsigned • int • short int • long int • unsigned int • unsigned short int • unsigned long int By: Satveer Kaur, Assistant Professor, Khalsa College, Patiala 5
  • 6. Integer types • Size = 2 byte(16 bit) • Range -32768 to 32767int or signed int • Size = 1 byte (8 bit) • Range -128 to 127 short int or signed short int • Size = 4 byte (32 bit) • Range -2,147,483,648 to 2,147,483,647 long int or signed long int By: Satveer Kaur, Assistant Professor, Khalsa College, Patiala 6
  • 7. Integer types • Size = 2 byte (16 bit) • Range 0 to 65535 unsigned int • Size = 1 byte (8 bit) • Range = 0 to 255 unsigned short int • Size = 4 byte (32 bit) • Range = 0 to 4,294,967,295 unsigned long int By: Satveer Kaur, Assistant Professor, Khalsa College, Patiala 7
  • 8. Floating point types float • Size = 4 byte (32 bit) • Range 3.4E-38 to 3.4E+38 double • Size = 8 byte (64 bit) • Range is 1.7E-308 to 1.7E+308 long double • Size = 10 byte (80 bit) • Range 3.4E-4932 to 3.4E+4932 By: Satveer Kaur, Assistant Professor, Khalsa College, Patiala 8
  • 9. Character types char or signed char •Size = 1 byte (8 bit) •Range -128 to 127 unsigned char •Size = 1 byte (8 bit) •Range 0 to 255 By: Satveer Kaur, Assistant Professor, Khalsa College, Patiala 9
  • 10. Void types void type has no values Used to specify the type of functions Also plays the role of generic type By: Satveer Kaur, Assistant Professor, Khalsa College, Patiala 10
  • 11. Data types and their keywords Data type Equivalent keyword Character char Unsigned character unsigned char Signed character signed char Signed integer signed int (or int) Signed short integer signed short int (or short int or short) Signed long integer signed long int (or long int or long) Unsigned integer unsigned int (or unsigned) Unsigned short integer unsigned short int (or unsigned short) Unsigned long integer unsigned long int (or unsigned long) Floating point float Double-precision floating point double Extended double precision floating point long double By: Satveer Kaur, Assistant Professor, Khalsa College, Patiala 11
  • 12. Derived data types  Are derived from primary data types. By: Satveer Kaur, Assistant Professor, Khalsa College, Patiala 12 • Sequence of data items having homogenous values. • Values are stored in adjacent locations. Array • Function pointers allow reference to the functions with a particular signature.References • Are used to access the memory locations • And deal with the addresses of variables.Pointers
  • 13. User-defined data types  ‘Type definition’ – a feature of ‘C’ allows the programmers to define their own identifiers to represent an existing data. By: Satveer Kaur, Assistant Professor, Khalsa College, Patiala 13 • a package of variables of different types under a single name. • To define a structure, ‘struct’ keyword is used. Structure • allow storage of various data types in the same memory location. • can defined with different members, but only a single member can contain a value at a given time. • To define a union, ‘union’ keyword is used. Union • a special data type that consists of integral constants, and each of them is assigned with a specific name. • To define an enumeration, ‘enum’ keyword is used. Enumeration
  • 14. Declaring primary data types with variable names int age; char letter; float height, width; By: Satveer Kaur, Assistant Professor, Khalsa College, Patiala 14
  • 15. Examples  #include <stdio.h>  int main()  {  int a = 400; // positive integer data type  float b = 5.2974; // float data type  char c = ‘A'; // char data type  long d = 42357; // long positive integer data type  long e = -41756; // long -ve integer data type  int f = -167; // -ve integer data type  short g = 330; // short +ve integer data type  short h = -830; // short -ve integer data type  double i = 7.1987654320; // double float data type  float j = -5.95; // float data type  } By: Satveer Kaur, Assistant Professor, Khalsa College, Patiala 15
  • 16. ThankYou By: Satveer Kaur, Assistant Professor, Khalsa College, Patiala 16