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 (20)

How to execute a C program
How to execute a C  program How to execute a C  program
How to execute a C program
 
C keywords and identifiers
C keywords and identifiersC keywords and identifiers
C keywords and identifiers
 
Constants and variables in c programming
Constants and variables in c programmingConstants and variables in c programming
Constants and variables in c programming
 
Arrays
ArraysArrays
Arrays
 
Operators in C Programming
Operators in C ProgrammingOperators in C Programming
Operators in C Programming
 
Python introduction
Python introductionPython introduction
Python introduction
 
Enumerated data types in C
Enumerated data types in CEnumerated data types in C
Enumerated data types in C
 
Array ppt
Array pptArray ppt
Array ppt
 
Pointers C programming
Pointers  C programmingPointers  C programming
Pointers C programming
 
Identifiers and keywords
Identifiers and keywordsIdentifiers and keywords
Identifiers and keywords
 
C tokens
C tokensC tokens
C tokens
 
Constants in C Programming
Constants in C ProgrammingConstants in C Programming
Constants in C Programming
 
SPL 10 | One Dimensional Array in C
SPL 10 | One Dimensional Array in CSPL 10 | One Dimensional Array in C
SPL 10 | One Dimensional Array in C
 
Chapter 2.datatypes and operators
Chapter 2.datatypes and operatorsChapter 2.datatypes and operators
Chapter 2.datatypes and operators
 
Datatypes in c
Datatypes in cDatatypes in c
Datatypes in c
 
C Pointers
C PointersC Pointers
C Pointers
 
C Token’s
C Token’sC Token’s
C Token’s
 
Strings and pointers
Strings and pointersStrings and pointers
Strings and pointers
 
C pointer
C pointerC pointer
C pointer
 
Programming flowcharts for C Language
Programming flowcharts for C LanguageProgramming flowcharts for C Language
Programming flowcharts for C Language
 

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

Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceSamikshaHamane
 
MICROBIOLOGY biochemical test detailed.pptx
MICROBIOLOGY biochemical test detailed.pptxMICROBIOLOGY biochemical test detailed.pptx
MICROBIOLOGY biochemical test detailed.pptxabhijeetpadhi001
 
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
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaVirag Sontakke
 
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
 
Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitolTechU
 
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
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...JhezDiaz1
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersSabitha Banu
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfUjwalaBharambe
 
Gas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxGas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxDr.Ibrahim Hassaan
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.arsicmarija21
 
Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentInMediaRes1
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPCeline George
 
MARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupMARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupJonathanParaisoCruz
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
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
 

Recently uploaded (20)

Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in Pharmacovigilance
 
MICROBIOLOGY biochemical test detailed.pptx
MICROBIOLOGY biochemical test detailed.pptxMICROBIOLOGY biochemical test detailed.pptx
MICROBIOLOGY biochemical test detailed.pptx
 
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
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of India
 
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
 
Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.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
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginners
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
 
Gas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxGas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptx
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.
 
Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media Component
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERP
 
MARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupMARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized Group
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
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
 

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