SlideShare a Scribd company logo
DAWOOD UNIVERSITY OF ENGINEERING
&
TECHNOLOGY
Computer Systems Engineering
Identifiers:
• Identifier is a name used to identify a variable, function or any other user-
defined item.
• It is an arbitrarily long sequence of digits (0 to 9).
• Lower case (a to z) & upper case (A to Z).
• Identifier should not be keywords.
• Special characters are not allowed except underscore (_).
• E.g. _ab1, ab_, etc.
There are two types of identifier.
1. standard identifiers.
2. user- defined identifiers.
1. Standard identifiers:
A type of identifier that has special meaning in c++. C++ cannot use a standard
identifier for the original purpose if it is re-defined.
* Cout & cin are the examples of standard identifier.
2. User-Defined Identifiers:
The type of identifier that is defined by the programmer to access memory
location.
* E.g. subject, age, marks, etc.
They are defined those variables which have special meaning and are pre-
defined in the c++ libraries.
* Keywords also known as reserved words.
* There are 63 keywords in c++ library.
* They are always written in lowercase.
* They cannot be used for another purpose like identifiers.
E.g. if, else, limit, delete, public, namespace, new, using, etc.
KEYWORDS:
Data types:
• Data types define the type of data a variable can hold, for example an integer variable can hold
integer data, a character type variable can hold character data etc.
• Data types in C++ are categorized in three groups:
1. Built-in data type.
2. user-defined data type.
3. Derive data type.
Built-in data type or Primitive Data Types:
These data types are built-in or predefined data types and can be used directly by the
user to declare variables.
1. char: For characters. Size 1 byte.
char ch = 'A';
2. int: For integers. Size 2 bytes.
int num = 100;
3. float: For single precision floating point. Size 4 bytes.
float num = 123.78987;
4. double: For double precision floating point. Size 8 bytes.
double num = 10098.98899;
5. bool: For booleans, true or false.
bool b = true;
6. wchar_t: Wide Character. This should be avoided because its size is implementation
defined and not reliable.
Derived Data Types:
The data-types that are derived from the primitive or built-in data types are referred to as Derived Data
Types.
1. Function: A function is a block of code or program-segment that is defined to perform a specific well-
defined task.
Syntax:
FunctionType FunctionName(parameters)
2. Array: An array is a collection of items stored at continuous memory locations. The idea of array is to
represent many instances in one variable.
Syntax:
DataType ArrayName[size_of_array];
3. Pointers: Pointers are symbolic representation of addresses.
Syntax:
datatype *var_name;
4. Reference: When a variable is declared as reference, it becomes an alternative name for an existing
variable.
Abstract or User-Defined Data Types:
These data types are defined by user itself. Like, defining a class in C++ or a
structure.
1. Class: The building block of C++ that leads to Object-Oriented
programming is a Class.
2. Structures: A structure creates a data type that can be used to group items
of possibly different types into a single type.
3. Union: In union, all members share the same memory location.
4. Enumeration: It is mainly used to assign names to integral constants, the
names make a program easy to read and maintain.
Introduction to c++

More Related Content

PPTX
Variables in C++, data types in c++
PPTX
Variables and data types in C++
PPTX
Lecture 2 variables
PPT
3 data-types-in-c
PPT
Data types and Operators
PPTX
Variables in C and C++ Language
PPTX
What are variables and keywords in c++
PPTX
Lec9
Variables in C++, data types in c++
Variables and data types in C++
Lecture 2 variables
3 data-types-in-c
Data types and Operators
Variables in C and C++ Language
What are variables and keywords in c++
Lec9

What's hot (20)

PPTX
Data types
PPT
Java: Primitive Data Types
PPTX
Constant, variables, data types
PPT
Lect 9(pointers) Zaheer Abbas
PPT
constants, variables and datatypes in C
PPTX
Data Types and Variables In C Programming
PPTX
Concept of c data types
PPTX
Data types in C
PPSX
Data types, Variables, Expressions & Arithmetic Operators in java
PPTX
Constant and variacles in c
PPT
Constants in C Programming
PPTX
data types in C programming
PDF
Lecture02(constants, variable & data types)
PPTX
02 data types in java
PPTX
Data Types, Variables, and Constants in C# Programming
PPTX
Data types in java | What is Datatypes in Java | Learning with RD | Created b...
PPTX
Data types
PDF
ITFT-Constants, variables and data types in java
PPTX
Datatype in c++ unit 3 -topic 2
Data types
Java: Primitive Data Types
Constant, variables, data types
Lect 9(pointers) Zaheer Abbas
constants, variables and datatypes in C
Data Types and Variables In C Programming
Concept of c data types
Data types in C
Data types, Variables, Expressions & Arithmetic Operators in java
Constant and variacles in c
Constants in C Programming
data types in C programming
Lecture02(constants, variable & data types)
02 data types in java
Data Types, Variables, and Constants in C# Programming
Data types in java | What is Datatypes in Java | Learning with RD | Created b...
Data types
ITFT-Constants, variables and data types in java
Datatype in c++ unit 3 -topic 2
Ad

Similar to Introduction to c++ (20)

PPTX
OOPS (object oriented programming) unit 1
PPTX
Concept Of C++ Data Types
 
PPT
Data Handling
PPTX
C++ Langauage Training in Ambala ! BATRA COMPUTER CENTRE
PPT
C++ tutorials
PPTX
Data types
PDF
C++ PPT IN NUMERICAL METHOD FOR M.Sc PHYSICS
PDF
Keywords, identifiers ,datatypes in C++
PPTX
C PROGRAMMING LANGUAGE
PDF
Cpprm
PPT
FP 201 Unit 2 - Part 2
PDF
Week 02_Development Environment of C++.pdf
PPTX
C++ FUNDAMENTALS (IDENTIFIER, VARIABLE )
PDF
POLITEKNIK MALAYSIA
PPTX
Ch-3(b) - Variables and Data types in C++.pptx
PPT
5-Lec - Datatypes.ppt
PPTX
Unit 1
PPTX
INTRODUCTION TO OBJECT ORIENTED PROGRAMMING.pptx
PPT
C++ data types
PPTX
C tokens
OOPS (object oriented programming) unit 1
Concept Of C++ Data Types
 
Data Handling
C++ Langauage Training in Ambala ! BATRA COMPUTER CENTRE
C++ tutorials
Data types
C++ PPT IN NUMERICAL METHOD FOR M.Sc PHYSICS
Keywords, identifiers ,datatypes in C++
C PROGRAMMING LANGUAGE
Cpprm
FP 201 Unit 2 - Part 2
Week 02_Development Environment of C++.pdf
C++ FUNDAMENTALS (IDENTIFIER, VARIABLE )
POLITEKNIK MALAYSIA
Ch-3(b) - Variables and Data types in C++.pptx
5-Lec - Datatypes.ppt
Unit 1
INTRODUCTION TO OBJECT ORIENTED PROGRAMMING.pptx
C++ data types
C tokens
Ad

Recently uploaded (20)

PDF
Human-AI Collaboration: Balancing Agentic AI and Autonomy in Hybrid Systems
PPTX
Artificial Intelligence
PPT
Mechanical Engineering MATERIALS Selection
PDF
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
PDF
Unit I ESSENTIAL OF DIGITAL MARKETING.pdf
PDF
Automation-in-Manufacturing-Chapter-Introduction.pdf
DOCX
573137875-Attendance-Management-System-original
PDF
PPT on Performance Review to get promotions
PPTX
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
PPTX
Safety Seminar civil to be ensured for safe working.
PPTX
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
PPTX
Construction Project Organization Group 2.pptx
PPTX
Fundamentals of Mechanical Engineering.pptx
PPTX
Foundation to blockchain - A guide to Blockchain Tech
PPTX
Geodesy 1.pptx...............................................
PDF
Well-logging-methods_new................
PDF
737-MAX_SRG.pdf student reference guides
PPTX
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
PPTX
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
PPTX
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
Human-AI Collaboration: Balancing Agentic AI and Autonomy in Hybrid Systems
Artificial Intelligence
Mechanical Engineering MATERIALS Selection
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
Unit I ESSENTIAL OF DIGITAL MARKETING.pdf
Automation-in-Manufacturing-Chapter-Introduction.pdf
573137875-Attendance-Management-System-original
PPT on Performance Review to get promotions
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
Safety Seminar civil to be ensured for safe working.
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
Construction Project Organization Group 2.pptx
Fundamentals of Mechanical Engineering.pptx
Foundation to blockchain - A guide to Blockchain Tech
Geodesy 1.pptx...............................................
Well-logging-methods_new................
737-MAX_SRG.pdf student reference guides
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx

Introduction to c++

  • 1. DAWOOD UNIVERSITY OF ENGINEERING & TECHNOLOGY Computer Systems Engineering
  • 2. Identifiers: • Identifier is a name used to identify a variable, function or any other user- defined item. • It is an arbitrarily long sequence of digits (0 to 9). • Lower case (a to z) & upper case (A to Z). • Identifier should not be keywords. • Special characters are not allowed except underscore (_). • E.g. _ab1, ab_, etc.
  • 3. There are two types of identifier. 1. standard identifiers. 2. user- defined identifiers. 1. Standard identifiers: A type of identifier that has special meaning in c++. C++ cannot use a standard identifier for the original purpose if it is re-defined. * Cout & cin are the examples of standard identifier. 2. User-Defined Identifiers: The type of identifier that is defined by the programmer to access memory location. * E.g. subject, age, marks, etc.
  • 4. They are defined those variables which have special meaning and are pre- defined in the c++ libraries. * Keywords also known as reserved words. * There are 63 keywords in c++ library. * They are always written in lowercase. * They cannot be used for another purpose like identifiers. E.g. if, else, limit, delete, public, namespace, new, using, etc. KEYWORDS:
  • 5. Data types: • Data types define the type of data a variable can hold, for example an integer variable can hold integer data, a character type variable can hold character data etc. • Data types in C++ are categorized in three groups: 1. Built-in data type. 2. user-defined data type. 3. Derive data type.
  • 6. Built-in data type or Primitive Data Types: These data types are built-in or predefined data types and can be used directly by the user to declare variables. 1. char: For characters. Size 1 byte. char ch = 'A'; 2. int: For integers. Size 2 bytes. int num = 100; 3. float: For single precision floating point. Size 4 bytes. float num = 123.78987; 4. double: For double precision floating point. Size 8 bytes. double num = 10098.98899; 5. bool: For booleans, true or false. bool b = true; 6. wchar_t: Wide Character. This should be avoided because its size is implementation defined and not reliable.
  • 7. Derived Data Types: The data-types that are derived from the primitive or built-in data types are referred to as Derived Data Types. 1. Function: A function is a block of code or program-segment that is defined to perform a specific well- defined task. Syntax: FunctionType FunctionName(parameters) 2. Array: An array is a collection of items stored at continuous memory locations. The idea of array is to represent many instances in one variable. Syntax: DataType ArrayName[size_of_array]; 3. Pointers: Pointers are symbolic representation of addresses. Syntax: datatype *var_name; 4. Reference: When a variable is declared as reference, it becomes an alternative name for an existing variable.
  • 8. Abstract or User-Defined Data Types: These data types are defined by user itself. Like, defining a class in C++ or a structure. 1. Class: The building block of C++ that leads to Object-Oriented programming is a Class. 2. Structures: A structure creates a data type that can be used to group items of possibly different types into a single type. 3. Union: In union, all members share the same memory location. 4. Enumeration: It is mainly used to assign names to integral constants, the names make a program easy to read and maintain.