SlideShare une entreprise Scribd logo
1  sur  20
In CC++ , data are mainly divided into
three different types. These are:
1. Character type data
2. Integer type data
3. Real data type
1. Character data type:
Characters (letters, digits and
punctuation character)
Are represented by the “char” data type.
The “short” data type is the same size as
“ char” ,usually one byte.
Character data type:
 Character data type must be signed and unsigned
(either short or long). Both occupying one byte each,
but have different ranges. To begin with, it might
appear strange as to how a char can have a sign.
Consider the statement
Char ch=‘A’
Char ty=‘B’
Char ze=‘D’ etc.
Character data type:
 A signed char is same as an ordinary char and has a
range from -128 to +127: where as, unsigned char has
a range from 0 to 255. let us now see a program below
#include<conio.h>
#include<stdio.h>
#include<stdlib.h>
Void main()
{
Char ch=291;
Printf(“n%c”,ch);
Getch();
}
2. Integer data type:
 Integer data type (whole numbers) are represented by
“int”.
 Some time, we know in advance that the value stored
in a given integer variable will always be positive when
it is being used to only count things.
 We can declared it as below.
Int a=20;
Int b=40;
Int c=30; etc
3: Float data type:
 Those number which are in decimal fraction are
represented by “float”.
 We can show float numbers in printf statement of
CC++ by “%f”.
 Float number are declared as
Float a=“40.00”
Float b=“23.04”
Float c=“10.3” etc
Float data type:
 We can write a program as:
#include<conio.h>
#include<stdio.h>
#include<stdlib.h>
Void main()
{
Float a=29.1;
Printf(“n%f”,a);
Getch();
}
Integer data type:
 We can write a program in CC++ are as shown below.
#include<conio.h>
#include<stdio.h>
#include<stdlib.h>
Void main()
{
Int a=291;
Printf(“n%d”,a);
Getch();
}
We can show the integer data type in C|C++ by “%d” in
printf statement.
CONSTANTS:
 Unlike variable, a constant is a fixed value that does
not change during the execution of program. We can
say that constant is a values while variable are holders
of these values. In C|C++, a constant may be divided
into main two types.
1. Numeric constant.
2. Non-numeric constant.
NUMERIC CONSTANT:
 Numbers are referred to as numeric constants.
Numeric constants are used for numeric purposes. It
contain:
 Numeric digits 0 to 9.
 Plus(+) or minus(-) signs.
 Decimal points
It is important to that note no commas or blanks are
allowed in numeric constants.
 In C|C++, numeric constant can be represented in
three ways.
Integer constant
Floating constant
Exponential real constant
OCTAL INTEGER CONSTANT:
 In C|C++ , any integer constant with a leading 0, is
interpreted as Octal constant an octal constant is a
base 8 numbers system and valid digits in octal system
are only 0 through 7. it is important to note that in
C|C++ , decimal integer constant cannot start with a
leading 0.
HEXADECIMAL INTEGER CONSTANT
 In CC++ any integer constant, which begins with 0x
or 0X, is interpreted as hexadecimal integer constant.
An hexadecimal constant is a base -16 number and
valid digit in hexadecimal system are 0 through
9,A,B,C,D,E and F.
FLOATING POINT CONSTANT:
 The numeric constant, which does not contain a
decimal point is known as floating point constant.
Like integer constant, floating points could either be
positive or negative.
NON NUMERIC CONSTANT:
 Non numeric constant are used for non numeric
purposes. Such as to produce output reports, heading
or printing messages etc, non numeric constant are
divided into two types.
 Character constant
 String constant
EXPONENTIAL REAL CONSTANT:
 Floating point constant can also be represented in the
E-notation form, and this type of numeric constant is
known as exponential real constant.
CHARACTER CONSTANT:
 In CC++, character constant are enclosed within
single quotes. It is important to note that the single
quotes are not part of the character constant, but they
serve to delimit it.
STRING CONSTANT:
 Any character or sequence of character between
double quotes is known as string constant or simply a
string.
ZAHID HUSSAIN
 Class no : 322
 Subject : Data types, Constants
 Shift : Evening
 Submitted to UMAR ALI SIR

Contenu connexe

Tendances (20)

Pointer in c
Pointer in cPointer in c
Pointer in c
 
Data types in C
Data types in CData types in C
Data types in C
 
Data structure ppt
Data structure pptData structure ppt
Data structure ppt
 
C tokens
C tokensC tokens
C tokens
 
Array in c++
Array in c++Array in c++
Array in c++
 
Tokens in C++
Tokens in C++Tokens in C++
Tokens in C++
 
String functions in C
String functions in CString functions in C
String functions in C
 
C functions
C functionsC functions
C functions
 
Structure of a C program
Structure of a C programStructure of a C program
Structure of a C program
 
Concept Of C++ Data Types
Concept Of C++ Data TypesConcept Of C++ Data Types
Concept Of C++ Data Types
 
Strings in C
Strings in CStrings in C
Strings in C
 
Introduction to data structure ppt
Introduction to data structure pptIntroduction to data structure ppt
Introduction to data structure ppt
 
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
 
Data types
Data typesData types
Data types
 
File handling in c
File handling in cFile handling in c
File handling in c
 
Basics of C programming
Basics of C programmingBasics of C programming
Basics of C programming
 
Functions in C
Functions in CFunctions in C
Functions in C
 
Basic Data Types in C++
Basic Data Types in C++ Basic Data Types in C++
Basic Data Types in C++
 
Constant, variables, data types
Constant, variables, data typesConstant, variables, data types
Constant, variables, data types
 
Array in c
Array in cArray in c
Array in c
 

Similaire à Data types

Object Oriented Programming with C++
Object Oriented Programming with C++Object Oriented Programming with C++
Object Oriented Programming with C++Rokonuzzaman Rony
 
C presentation book
C presentation bookC presentation book
C presentation bookkrunal1210
 
C programming tutorial
C programming tutorialC programming tutorial
C programming tutorialMohit Saini
 
2 expressions (ppt-2) in C++
2 expressions (ppt-2) in C++2 expressions (ppt-2) in C++
2 expressions (ppt-2) in C++Kuntal Bhowmick
 
INTRODUCTION TO C++.pptx
INTRODUCTION TO C++.pptxINTRODUCTION TO C++.pptx
INTRODUCTION TO C++.pptxMamataAnilgod
 
Bsc cs i pic u-2 datatypes and variables in c language
Bsc cs i pic u-2 datatypes and variables in c languageBsc cs i pic u-2 datatypes and variables in c language
Bsc cs i pic u-2 datatypes and variables in c languageRai University
 
Getting started with c++
Getting started with c++Getting started with c++
Getting started with c++K Durga Prasad
 
datatypes and variables in c language
 datatypes and variables in c language datatypes and variables in c language
datatypes and variables in c languageRai University
 
Btech i pic u-2 datatypes and variables in c language
Btech i pic u-2 datatypes and variables in c languageBtech i pic u-2 datatypes and variables in c language
Btech i pic u-2 datatypes and variables in c languageRai University
 
Mca i pic u-2 datatypes and variables in c language
Mca i pic u-2 datatypes and variables in c languageMca i pic u-2 datatypes and variables in c language
Mca i pic u-2 datatypes and variables in c languageRai University
 
Diploma ii cfpc u-2 datatypes and variables in c language
Diploma ii  cfpc u-2 datatypes and variables in c languageDiploma ii  cfpc u-2 datatypes and variables in c language
Diploma ii cfpc u-2 datatypes and variables in c languageRai University
 
presentation_data_types_and_operators_1513499834_241350.pptx
presentation_data_types_and_operators_1513499834_241350.pptxpresentation_data_types_and_operators_1513499834_241350.pptx
presentation_data_types_and_operators_1513499834_241350.pptxKrishanPalSingh39
 

Similaire à Data types (20)

Data types
Data typesData types
Data types
 
Object Oriented Programming with C++
Object Oriented Programming with C++Object Oriented Programming with C++
Object Oriented Programming with C++
 
C Token’s
C Token’sC Token’s
C Token’s
 
C presentation book
C presentation bookC presentation book
C presentation book
 
C programming tutorial
C programming tutorialC programming tutorial
C programming tutorial
 
Lecture 6- Intorduction to C Programming
Lecture 6- Intorduction to C ProgrammingLecture 6- Intorduction to C Programming
Lecture 6- Intorduction to C Programming
 
C++
C++C++
C++
 
CHAPTER 2
CHAPTER 2CHAPTER 2
CHAPTER 2
 
2 expressions (ppt-2) in C++
2 expressions (ppt-2) in C++2 expressions (ppt-2) in C++
2 expressions (ppt-2) in C++
 
Module 1 PCD.docx
Module 1 PCD.docxModule 1 PCD.docx
Module 1 PCD.docx
 
INTRODUCTION TO C++.pptx
INTRODUCTION TO C++.pptxINTRODUCTION TO C++.pptx
INTRODUCTION TO C++.pptx
 
Bsc cs i pic u-2 datatypes and variables in c language
Bsc cs i pic u-2 datatypes and variables in c languageBsc cs i pic u-2 datatypes and variables in c language
Bsc cs i pic u-2 datatypes and variables in c language
 
Getting started with c++
Getting started with c++Getting started with c++
Getting started with c++
 
Getting started with c++
Getting started with c++Getting started with c++
Getting started with c++
 
datatypes and variables in c language
 datatypes and variables in c language datatypes and variables in c language
datatypes and variables in c language
 
Btech i pic u-2 datatypes and variables in c language
Btech i pic u-2 datatypes and variables in c languageBtech i pic u-2 datatypes and variables in c language
Btech i pic u-2 datatypes and variables in c language
 
Mca i pic u-2 datatypes and variables in c language
Mca i pic u-2 datatypes and variables in c languageMca i pic u-2 datatypes and variables in c language
Mca i pic u-2 datatypes and variables in c language
 
Basic of c &c++
Basic of c &c++Basic of c &c++
Basic of c &c++
 
Diploma ii cfpc u-2 datatypes and variables in c language
Diploma ii  cfpc u-2 datatypes and variables in c languageDiploma ii  cfpc u-2 datatypes and variables in c language
Diploma ii cfpc u-2 datatypes and variables in c language
 
presentation_data_types_and_operators_1513499834_241350.pptx
presentation_data_types_and_operators_1513499834_241350.pptxpresentation_data_types_and_operators_1513499834_241350.pptx
presentation_data_types_and_operators_1513499834_241350.pptx
 

Dernier

Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
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
 
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
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
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
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpinRaunakKeshri1
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
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
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991RKavithamani
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
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
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
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
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
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
 

Dernier (20)

Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
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...
 
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
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
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
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
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
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
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
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .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
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application )
 

Data types

  • 1. In CC++ , data are mainly divided into three different types. These are: 1. Character type data 2. Integer type data 3. Real data type
  • 2. 1. Character data type: Characters (letters, digits and punctuation character) Are represented by the “char” data type. The “short” data type is the same size as “ char” ,usually one byte.
  • 3. Character data type:  Character data type must be signed and unsigned (either short or long). Both occupying one byte each, but have different ranges. To begin with, it might appear strange as to how a char can have a sign. Consider the statement Char ch=‘A’ Char ty=‘B’ Char ze=‘D’ etc.
  • 4. Character data type:  A signed char is same as an ordinary char and has a range from -128 to +127: where as, unsigned char has a range from 0 to 255. let us now see a program below #include<conio.h> #include<stdio.h> #include<stdlib.h> Void main() { Char ch=291; Printf(“n%c”,ch); Getch(); }
  • 5. 2. Integer data type:  Integer data type (whole numbers) are represented by “int”.  Some time, we know in advance that the value stored in a given integer variable will always be positive when it is being used to only count things.  We can declared it as below. Int a=20; Int b=40; Int c=30; etc
  • 6. 3: Float data type:  Those number which are in decimal fraction are represented by “float”.  We can show float numbers in printf statement of CC++ by “%f”.  Float number are declared as Float a=“40.00” Float b=“23.04” Float c=“10.3” etc
  • 7. Float data type:  We can write a program as: #include<conio.h> #include<stdio.h> #include<stdlib.h> Void main() { Float a=29.1; Printf(“n%f”,a); Getch(); }
  • 8. Integer data type:  We can write a program in CC++ are as shown below. #include<conio.h> #include<stdio.h> #include<stdlib.h> Void main() { Int a=291; Printf(“n%d”,a); Getch(); } We can show the integer data type in C|C++ by “%d” in printf statement.
  • 9. CONSTANTS:  Unlike variable, a constant is a fixed value that does not change during the execution of program. We can say that constant is a values while variable are holders of these values. In C|C++, a constant may be divided into main two types. 1. Numeric constant. 2. Non-numeric constant.
  • 10. NUMERIC CONSTANT:  Numbers are referred to as numeric constants. Numeric constants are used for numeric purposes. It contain:  Numeric digits 0 to 9.  Plus(+) or minus(-) signs.  Decimal points It is important to that note no commas or blanks are allowed in numeric constants.
  • 11.  In C|C++, numeric constant can be represented in three ways. Integer constant Floating constant Exponential real constant
  • 12.
  • 13. OCTAL INTEGER CONSTANT:  In C|C++ , any integer constant with a leading 0, is interpreted as Octal constant an octal constant is a base 8 numbers system and valid digits in octal system are only 0 through 7. it is important to note that in C|C++ , decimal integer constant cannot start with a leading 0.
  • 14. HEXADECIMAL INTEGER CONSTANT  In CC++ any integer constant, which begins with 0x or 0X, is interpreted as hexadecimal integer constant. An hexadecimal constant is a base -16 number and valid digit in hexadecimal system are 0 through 9,A,B,C,D,E and F.
  • 15. FLOATING POINT CONSTANT:  The numeric constant, which does not contain a decimal point is known as floating point constant. Like integer constant, floating points could either be positive or negative.
  • 16. NON NUMERIC CONSTANT:  Non numeric constant are used for non numeric purposes. Such as to produce output reports, heading or printing messages etc, non numeric constant are divided into two types.  Character constant  String constant
  • 17. EXPONENTIAL REAL CONSTANT:  Floating point constant can also be represented in the E-notation form, and this type of numeric constant is known as exponential real constant.
  • 18. CHARACTER CONSTANT:  In CC++, character constant are enclosed within single quotes. It is important to note that the single quotes are not part of the character constant, but they serve to delimit it.
  • 19. STRING CONSTANT:  Any character or sequence of character between double quotes is known as string constant or simply a string.
  • 20. ZAHID HUSSAIN  Class no : 322  Subject : Data types, Constants  Shift : Evening  Submitted to UMAR ALI SIR