SlideShare a Scribd company logo
2
Most read
10
Most read
20
Most read
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
Data types
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

More Related Content

PPTX
Data types in C
Tarun Sharma
 
PPTX
data types in C programming
Harshita Yadav
 
PPTX
ELECTRICITY BILLING SYSTEM (1).pptx
ABHISHEKJADHAV106697
 
PPTX
Political history (1988 -1999)
Muslimhands
 
PPTX
Operator.ppt
Darshan Patel
 
PPTX
Data types in C
Ansh Kashyap
 
PPTX
Data types
Nokesh Prabhakar
 
PPTX
what is electricity?? ppt
Home
 
Data types in C
Tarun Sharma
 
data types in C programming
Harshita Yadav
 
ELECTRICITY BILLING SYSTEM (1).pptx
ABHISHEKJADHAV106697
 
Political history (1988 -1999)
Muslimhands
 
Operator.ppt
Darshan Patel
 
Data types in C
Ansh Kashyap
 
Data types
Nokesh Prabhakar
 
what is electricity?? ppt
Home
 

What's hot (20)

PPTX
Dynamic memory allocation
Viji B
 
PPT
Variables in C Programming
programming9
 
PPTX
Pointer in c
lavanya marichamy
 
PPTX
Structure in C
Kamal Acharya
 
PPTX
Functions in C
Kamal Acharya
 
PPTX
Control statements in c
Sathish Narayanan
 
DOC
Arrays and Strings
Dr.Subha Krishna
 
PPTX
Arrays in c
Jeeva Nanthini
 
PPTX
Strings in C
Kamal Acharya
 
PPT
programming with python ppt
Priyanka Pradhan
 
PPTX
Programming in c Arrays
janani thirupathi
 
PPT
Structure of a C program
David Livingston J
 
PPTX
Pointers in C Programming
Jasleen Kaur (Chandigarh University)
 
PPTX
C tokens
Manu1325
 
PPT
Strings
Mitali Chugh
 
PPTX
Function in C program
Nurul Zakiah Zamri Tan
 
PDF
Object oriented programming c++
Ankur Pandey
 
PPTX
Array ppt
Kaushal Mehta
 
PPTX
Data types in c++
Venkata.Manish Reddy
 
Dynamic memory allocation
Viji B
 
Variables in C Programming
programming9
 
Pointer in c
lavanya marichamy
 
Structure in C
Kamal Acharya
 
Functions in C
Kamal Acharya
 
Control statements in c
Sathish Narayanan
 
Arrays and Strings
Dr.Subha Krishna
 
Arrays in c
Jeeva Nanthini
 
Strings in C
Kamal Acharya
 
programming with python ppt
Priyanka Pradhan
 
Programming in c Arrays
janani thirupathi
 
Structure of a C program
David Livingston J
 
Pointers in C Programming
Jasleen Kaur (Chandigarh University)
 
C tokens
Manu1325
 
Strings
Mitali Chugh
 
Function in C program
Nurul Zakiah Zamri Tan
 
Object oriented programming c++
Ankur Pandey
 
Array ppt
Kaushal Mehta
 
Data types in c++
Venkata.Manish Reddy
 
Ad

Similar to Data types (20)

PPTX
Data types
Zahid Hussain
 
PPTX
Object Oriented Programming with C++
Rokonuzzaman Rony
 
PPTX
C Token’s
Tarun Sharma
 
PPT
C presentation book
krunal1210
 
DOCX
C programming tutorial
Mohit Saini
 
PPT
Lecture 6- Intorduction to C Programming
Md. Imran Hossain Showrov
 
PDF
C++
Shyam Khant
 
PPTX
CHAPTER 2
mohd_mizan
 
PDF
2 expressions (ppt-2) in C++
Kuntal Bhowmick
 
DOCX
Module 1 PCD.docx
VijayKumar886687
 
PDF
Week 02_Development Environment of C++.pdf
salmankhizar3
 
PPTX
INTRODUCTION TO C++.pptx
MamataAnilgod
 
PPTX
Bsc cs i pic u-2 datatypes and variables in c language
Rai University
 
PPT
Getting started with c++
K Durga Prasad
 
PPT
Getting started with c++
Bussines man badhrinadh
 
PPTX
datatypes and variables in c language
Rai University
 
PPTX
Btech i pic u-2 datatypes and variables in c language
Rai University
 
PPTX
Mca i pic u-2 datatypes and variables in c language
Rai University
 
PPT
Basic of c &c++
guptkashish
 
PPTX
Diploma ii cfpc u-2 datatypes and variables in c language
Rai University
 
Data types
Zahid Hussain
 
Object Oriented Programming with C++
Rokonuzzaman Rony
 
C Token’s
Tarun Sharma
 
C presentation book
krunal1210
 
C programming tutorial
Mohit Saini
 
Lecture 6- Intorduction to C Programming
Md. Imran Hossain Showrov
 
CHAPTER 2
mohd_mizan
 
2 expressions (ppt-2) in C++
Kuntal Bhowmick
 
Module 1 PCD.docx
VijayKumar886687
 
Week 02_Development Environment of C++.pdf
salmankhizar3
 
INTRODUCTION TO C++.pptx
MamataAnilgod
 
Bsc cs i pic u-2 datatypes and variables in c language
Rai University
 
Getting started with c++
K Durga Prasad
 
Getting started with c++
Bussines man badhrinadh
 
datatypes and variables in c language
Rai University
 
Btech i pic u-2 datatypes and variables in c language
Rai University
 
Mca i pic u-2 datatypes and variables in c language
Rai University
 
Basic of c &c++
guptkashish
 
Diploma ii cfpc u-2 datatypes and variables in c language
Rai University
 
Ad

Recently uploaded (20)

PPTX
CONCEPT OF CHILD CARE. pptx
AneetaSharma15
 
PDF
Biological Classification Class 11th NCERT CBSE NEET.pdf
NehaRohtagi1
 
PPTX
Sonnet 130_ My Mistress’ Eyes Are Nothing Like the Sun By William Shakespear...
DhatriParmar
 
PPTX
Cleaning Validation Ppt Pharmaceutical validation
Ms. Ashatai Patil
 
DOCX
Unit 5: Speech-language and swallowing disorders
JELLA VISHNU DURGA PRASAD
 
PPTX
Command Palatte in Odoo 18.1 Spreadsheet - Odoo Slides
Celine George
 
PPTX
How to Manage Leads in Odoo 18 CRM - Odoo Slides
Celine George
 
PPTX
How to Track Skills & Contracts Using Odoo 18 Employee
Celine George
 
PPTX
CARE OF UNCONSCIOUS PATIENTS .pptx
AneetaSharma15
 
PPTX
PROTIEN ENERGY MALNUTRITION: NURSING MANAGEMENT.pptx
PRADEEP ABOTHU
 
PDF
What is CFA?? Complete Guide to the Chartered Financial Analyst Program
sp4989653
 
PDF
Antianginal agents, Definition, Classification, MOA.pdf
Prerana Jadhav
 
PDF
BÀI TáșŹP TEST BỔ TRỹ THEO Tá»ȘNG CHỊ ĐỀ CỊA Tá»ȘNG UNIT KÈM BÀI TáșŹP NGHE - TIáșŸNG A...
Nguyen Thanh Tu Collection
 
PDF
Health-The-Ultimate-Treasure (1).pdf/8th class science curiosity /samyans edu...
Sandeep Swamy
 
PPTX
CDH. pptx
AneetaSharma15
 
PDF
Module 2: Public Health History [Tutorial Slides]
JonathanHallett4
 
PPTX
Care of patients with elImination deviation.pptx
AneetaSharma15
 
PDF
The Minister of Tourism, Culture and Creative Arts, Abla Dzifa Gomashie has e...
nservice241
 
PDF
Virat Kohli- the Pride of Indian cricket
kushpar147
 
PPTX
Artificial-Intelligence-in-Drug-Discovery by R D Jawarkar.pptx
Rahul Jawarkar
 
CONCEPT OF CHILD CARE. pptx
AneetaSharma15
 
Biological Classification Class 11th NCERT CBSE NEET.pdf
NehaRohtagi1
 
Sonnet 130_ My Mistress’ Eyes Are Nothing Like the Sun By William Shakespear...
DhatriParmar
 
Cleaning Validation Ppt Pharmaceutical validation
Ms. Ashatai Patil
 
Unit 5: Speech-language and swallowing disorders
JELLA VISHNU DURGA PRASAD
 
Command Palatte in Odoo 18.1 Spreadsheet - Odoo Slides
Celine George
 
How to Manage Leads in Odoo 18 CRM - Odoo Slides
Celine George
 
How to Track Skills & Contracts Using Odoo 18 Employee
Celine George
 
CARE OF UNCONSCIOUS PATIENTS .pptx
AneetaSharma15
 
PROTIEN ENERGY MALNUTRITION: NURSING MANAGEMENT.pptx
PRADEEP ABOTHU
 
What is CFA?? Complete Guide to the Chartered Financial Analyst Program
sp4989653
 
Antianginal agents, Definition, Classification, MOA.pdf
Prerana Jadhav
 
BÀI TáșŹP TEST BỔ TRỹ THEO Tá»ȘNG CHỊ ĐỀ CỊA Tá»ȘNG UNIT KÈM BÀI TáșŹP NGHE - TIáșŸNG A...
Nguyen Thanh Tu Collection
 
Health-The-Ultimate-Treasure (1).pdf/8th class science curiosity /samyans edu...
Sandeep Swamy
 
CDH. pptx
AneetaSharma15
 
Module 2: Public Health History [Tutorial Slides]
JonathanHallett4
 
Care of patients with elImination deviation.pptx
AneetaSharma15
 
The Minister of Tourism, Culture and Creative Arts, Abla Dzifa Gomashie has e...
nservice241
 
Virat Kohli- the Pride of Indian cricket
kushpar147
 
Artificial-Intelligence-in-Drug-Discovery by R D Jawarkar.pptx
Rahul Jawarkar
 

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
  • 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