0% found this document useful (0 votes)
282 views11 pages

Datatypes in C++

Datatypes are a very fundamental and important part of any programming language. This ppt will give a clear understanding of datatypes in C++.

Uploaded by

Anushka Gupta
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
282 views11 pages

Datatypes in C++

Datatypes are a very fundamental and important part of any programming language. This ppt will give a clear understanding of datatypes in C++.

Uploaded by

Anushka Gupta
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 11

DATATYPES IN

Overview
 Introduction to C++
 What are datatypes
 Datatypes in C++ :
 Primary
 Derived
 User-defined

 Conclusion
Introduction to C++
C++ is a general-purpose programming language and is widely used nowadays for
competitive programming. It was developed to enhance the C language with
object-oriented programming.
Features of C++:
 It is an object-oriented programming language
 It is a mid-level language.
 It is a machine independent but platform-dependent language
 It has a rich library support
 It has a high speed of execution.

There is no official documentation for C++ available, however the closest


available document is the C++ Core Guidelines.
What are Datatypes?
To define datatypes we first need to know what are variables and its types.

 VARIABLE - A variable is a named unit of data that is assigned a value.

 DATATYPE - A data type is a classification that restricts what a variable or


object can hold in computer programming. They specify the size and type of
the value to be stored in the variable.

In the given image ‘int’ and ‘char’ are the datatypes


whereas ‘item1’ and ‘item2’ are variables.
Datatypes in C++
C++ supports a variety of datatypes and the developer can choose the datatype
according to its needs.
They can be broadly classified into three categories: Primitive, Derived and User Defined

Datatypes
in C++

User
Primitive Derived
Defined
• Int
• Function • Class
• Char
• Array • Structure
• Double
• Pointer • Union
• Boolean
• Reference • Enum
• Void
Primitive Datatypes
These datatypes are built-in or predefined in the language itself. They can directly
be used to declare the variables.
Primitive datatypes are of the following types:
 Integer
 Character
 Boolean
 Floating Point
 Double Floating Point
 Void or Valueless
 Wide Character
The sizeof() operator is used to find out the number of bytes occupied by the
datatype in the memory.
Data Type Size(in bytes)

Char 1

Int 4

bool 1

Float 4

double 8

This code demonstrates the use to sizeof operator The output of the previous code. Results may
to find the memory occupied by a primitive vary from machine to machine
datatype in your computer
Derived Datatypes
These are datatypes which have been derived from built-in datatypes.
Primarily they are of the following types:
 Function
 Array
 Pointer
 Reference

The above code demonstrates the use of derived


data types – arrays, function and pointers.
User Defined Datatypes
These datatypes are defined by the users themselves. These datatypes generally
contain a combination of many primitive and derived datatypes.
Primarily they are of the following types:
 Class
 Structure
 Union
 Enum

The above code demonstrates the use of user


defined data types – structures
Conclusion
When writing a program, a programmer must properly define
event and entity properties and for that they must have to
have a good understanding of data types.
Application of knowledge on datatypes is not limited to data
collection or instrumentation; other activities such as data
management, data integration, and internal application
development (using no-code or low-code tools) also require
proper knowledge of datatypes.
THANK YOU
https://www.cetpainfotech.com/
9212172602
[email protected]

You might also like