SlideShare a Scribd company logo
Constants, Variables and Data Types
Topics
 Token, Keyword, Identifier
 Constant, Variable
 Data types
Token and Keyword
 Token- In a C program the smallest individual units
are known as C tokens. C has six types of tokens.
1. Keyword- float, int, while
2. Identifier- main, amount
3. Constant- 10.5, 10
4. String- “ABC”, “Khulna”
5. Special symbol- [ ], { }
6. Operator- +,-,*
 Keyword- Keywords are the reserve words which
have fixed meanings and that cannot be changed.
Ex- float, double, while, char, do, if, else
Identifier, Constant
 Identifier- Identifiers refer to the names of variables,
functions and arrays.
 Constant- Constants in C refer to fixed values do
not change during the execution of a program. Ex-
123, -0.75, ‘X’, “CSE”
 Process of declaring constant:
1. #define: #define const_name value
Ex: #define MAX 100
2. const: const data_type const_name = value;
Ex: const int MAX=100;
Variable
 Variable- A variable is a data name that may be
used to store data value. A variable may take
different values at different times during execution.
 Rules of variable name:
1. It must begin with a letter. Some systems permit
underscore as the first character.
2. ANSI standard recognizes a length of 31
characters. But it should normally in between 8 char.
3. Uppercase and lowercase are different.
4. Variable name should not be a keyword.
5. White space is not allowed.
Data Types
 Primary data types- character, Integer, Float,
Double
 User-defined data types- Structure, Union, Class,
Enumeration
 Derived data types- Array, Function, Pointer,
Reference
Modifier or Qualifier
 Modifier- The keyword like short, long, unsigned,
signed can change the data storage capacity of the
variable. So they are called modifier or qualifier.
 Type Size (bits) Range
char 8 -128 to 127
int or short int 16 -32768 to 32767
unsigned int 16 0 to 65535
short int 8 -128 to 127
long int 32 -2147483648 to 2147483648
float 32 3.4E-38 to 3.4E+38
double 64 1.7E-308 to 1.7E+308
long double 80 3.4E-4932 to 3.4E+4932
Variable Declaration
 Declaration does two things:
1. It tells the compiler what the variable name
is.
2. It specifies what type of data the variable
will hold.
 The declaration of variables must be done
before they are used in the program.
 Rule: Data_type Var_name;
 Ex: int x, y;
float area;
Assigning values to Variables
 Rule: var_name = constant;
Ex: balance = 1277.50;
ch = ‘Y’;
 C permits multiple assignments in one line.
Ex: length=10; height=5;
 It is also possible to assign a value to a variable at
the time of variable declaration.
Ex: int x = 100;
 C permits the initialization of more than one
variables in one statement using multiple
assignment operators.
Ex: x = y = z = 100;

More Related Content

What's hot

Concept Of C++ Data Types
Concept Of C++ Data TypesConcept Of C++ Data Types
Concept Of C++ Data Types
k v
 
Data types
Data typesData types
Data types
Nokesh Prabhakar
 
C++ data types
C++ data typesC++ data types
C++ data types
pratikborsadiya
 
Concept of c data types
Concept of c data typesConcept of c data types
Concept of c data types
Manisha Keim
 
Data types
Data typesData types
Data types
Syed Umair
 
Java: Primitive Data Types
Java: Primitive Data TypesJava: Primitive Data Types
Java: Primitive Data Types
Tareq Hasan
 
Datatype in c++ unit 3 -topic 2
Datatype in c++ unit 3 -topic 2Datatype in c++ unit 3 -topic 2
Datatype in c++ unit 3 -topic 2
MOHIT TOMAR
 
Data Types, Variables, and Constants in C# Programming
Data Types, Variables, and Constants in C# ProgrammingData Types, Variables, and Constants in C# Programming
Data Types, Variables, and Constants in C# Programming
Sherwin Banaag Sapin
 
Data types in C
Data types in CData types in C
Data types in C
Tarun Sharma
 
Data types in C
Data types in CData types in C
Data types in C
Satveer Mann
 
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
Kamal Acharya
 
Data types
Data typesData types
Data types
Zahid Hussain
 
Variables and data types in C++
Variables and data types in C++Variables and data types in C++
Variables and data types in C++
Ameer Khan
 
Data types in C language
Data types in C languageData types in C language
Data types in C language
kashyap399
 
Basic Data Types in C++
Basic Data Types in C++ Basic Data Types in C++
Basic Data Types in C++
Hridoy Bepari
 
Structures in c language
Structures in c languageStructures in c language
Structures in c language
tanmaymodi4
 
Introduction to c++
Introduction to c++Introduction to c++
Introduction to c++
NIDA HUSSAIN
 
Ch 2.
Ch 2.Ch 2.
Presentation on c structures
Presentation on c   structures Presentation on c   structures
Presentation on c structures
topu93
 
Numerical data.
Numerical data.Numerical data.
Numerical data.
Adewumi Ezekiel Adebayo
 

What's hot (20)

Concept Of C++ Data Types
Concept Of C++ Data TypesConcept Of C++ Data Types
Concept Of C++ Data Types
 
Data types
Data typesData types
Data types
 
C++ data types
C++ data typesC++ data types
C++ data types
 
Concept of c data types
Concept of c data typesConcept of c data types
Concept of c data types
 
Data types
Data typesData types
Data types
 
Java: Primitive Data Types
Java: Primitive Data TypesJava: Primitive Data Types
Java: Primitive Data Types
 
Datatype in c++ unit 3 -topic 2
Datatype in c++ unit 3 -topic 2Datatype in c++ unit 3 -topic 2
Datatype in c++ unit 3 -topic 2
 
Data Types, Variables, and Constants in C# Programming
Data Types, Variables, and Constants in C# ProgrammingData Types, Variables, and Constants in C# Programming
Data Types, Variables, and Constants in C# Programming
 
Data types in C
Data types in CData types in C
Data types in C
 
Data types in C
Data types in CData types in C
Data types in C
 
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
 
Variables and data types in C++
Variables and data types in C++Variables and data types in C++
Variables and data types in C++
 
Data types in C language
Data types in C languageData types in C language
Data types in C language
 
Basic Data Types in C++
Basic Data Types in C++ Basic Data Types in C++
Basic Data Types in C++
 
Structures in c language
Structures in c languageStructures in c language
Structures in c language
 
Introduction to c++
Introduction to c++Introduction to c++
Introduction to c++
 
Ch 2.
Ch 2.Ch 2.
Ch 2.
 
Presentation on c structures
Presentation on c   structures Presentation on c   structures
Presentation on c structures
 
Numerical data.
Numerical data.Numerical data.
Numerical data.
 

Viewers also liked

Chapter 7.4
Chapter 7.4Chapter 7.4
Chapter 7.4
sotlsoc
 
Chapter 3.1
Chapter 3.1Chapter 3.1
Chapter 3.1
sotlsoc
 
Basics in algorithms and data structure
Basics in algorithms and data structure Basics in algorithms and data structure
Basics in algorithms and data structure
Eman magdy
 
Data Structure Basics
Data Structure BasicsData Structure Basics
Data Structure Basics
Shakila Mahjabin
 
Webpage Visual Design and Online Prototype
Webpage Visual Design and Online PrototypeWebpage Visual Design and Online Prototype
Webpage Visual Design and Online Prototype
amoore155
 
Logic Formulation 2
Logic Formulation 2Logic Formulation 2
Logic Formulation 2
deathful
 
2. electric field calculation
2. electric field calculation2. electric field calculation
Calculus II - 16
Calculus II - 16Calculus II - 16
Calculus II - 16
David Mao
 
Digital Logic
Digital LogicDigital Logic
Digital Logic
Dilum Bandara
 
Calculus II - 15
Calculus II - 15Calculus II - 15
Calculus II - 15
David Mao
 
Problem Solving with Algorithms and Data Structure - Lists
Problem Solving with Algorithms and Data Structure - ListsProblem Solving with Algorithms and Data Structure - Lists
Problem Solving with Algorithms and Data Structure - Lists
Yi-Lung Tsai
 
Problem Solving with Algorithms and Data Structure - Graphs
Problem Solving with Algorithms and Data Structure - GraphsProblem Solving with Algorithms and Data Structure - Graphs
Problem Solving with Algorithms and Data Structure - Graphs
Yi-Lung Tsai
 
Komunikasyon
KomunikasyonKomunikasyon
Komunikasyon
deathful
 
Data Structure & Algorithms | Computer Science
Data Structure & Algorithms | Computer ScienceData Structure & Algorithms | Computer Science
Data Structure & Algorithms | Computer Science
Transweb Global Inc
 
ppt of VCLA
ppt of VCLAppt of VCLA
ppt of VCLA
Nirali Akabari
 
Data structures and algorithms
Data structures and algorithmsData structures and algorithms
Data structures and algorithms
Julie Iskander
 
មេរៀនៈ Data Structure and Algorithm in C/C++
មេរៀនៈ Data Structure and Algorithm in C/C++មេរៀនៈ Data Structure and Algorithm in C/C++
មេរៀនៈ Data Structure and Algorithm in C/C++
Ngeam Soly
 
Curves and surfaces
Curves and surfacesCurves and surfaces
Curves and surfaces
Mohammed Mahmoud
 
Earthing Concepts
Earthing ConceptsEarthing Concepts
Earthing Concepts
mvrkprasad
 
Electrical grounding and earthing
Electrical grounding and earthingElectrical grounding and earthing
Electrical grounding and earthing
Nitesh Dash
 

Viewers also liked (20)

Chapter 7.4
Chapter 7.4Chapter 7.4
Chapter 7.4
 
Chapter 3.1
Chapter 3.1Chapter 3.1
Chapter 3.1
 
Basics in algorithms and data structure
Basics in algorithms and data structure Basics in algorithms and data structure
Basics in algorithms and data structure
 
Data Structure Basics
Data Structure BasicsData Structure Basics
Data Structure Basics
 
Webpage Visual Design and Online Prototype
Webpage Visual Design and Online PrototypeWebpage Visual Design and Online Prototype
Webpage Visual Design and Online Prototype
 
Logic Formulation 2
Logic Formulation 2Logic Formulation 2
Logic Formulation 2
 
2. electric field calculation
2. electric field calculation2. electric field calculation
2. electric field calculation
 
Calculus II - 16
Calculus II - 16Calculus II - 16
Calculus II - 16
 
Digital Logic
Digital LogicDigital Logic
Digital Logic
 
Calculus II - 15
Calculus II - 15Calculus II - 15
Calculus II - 15
 
Problem Solving with Algorithms and Data Structure - Lists
Problem Solving with Algorithms and Data Structure - ListsProblem Solving with Algorithms and Data Structure - Lists
Problem Solving with Algorithms and Data Structure - Lists
 
Problem Solving with Algorithms and Data Structure - Graphs
Problem Solving with Algorithms and Data Structure - GraphsProblem Solving with Algorithms and Data Structure - Graphs
Problem Solving with Algorithms and Data Structure - Graphs
 
Komunikasyon
KomunikasyonKomunikasyon
Komunikasyon
 
Data Structure & Algorithms | Computer Science
Data Structure & Algorithms | Computer ScienceData Structure & Algorithms | Computer Science
Data Structure & Algorithms | Computer Science
 
ppt of VCLA
ppt of VCLAppt of VCLA
ppt of VCLA
 
Data structures and algorithms
Data structures and algorithmsData structures and algorithms
Data structures and algorithms
 
មេរៀនៈ Data Structure and Algorithm in C/C++
មេរៀនៈ Data Structure and Algorithm in C/C++មេរៀនៈ Data Structure and Algorithm in C/C++
មេរៀនៈ Data Structure and Algorithm in C/C++
 
Curves and surfaces
Curves and surfacesCurves and surfaces
Curves and surfaces
 
Earthing Concepts
Earthing ConceptsEarthing Concepts
Earthing Concepts
 
Electrical grounding and earthing
Electrical grounding and earthingElectrical grounding and earthing
Electrical grounding and earthing
 

Similar to Chap 2(const var-datatype)

PSPC--UNIT-2.pdf
PSPC--UNIT-2.pdfPSPC--UNIT-2.pdf
PSPC--UNIT-2.pdf
ArshiniGubbala3
 
Data Handling
Data HandlingData Handling
Data Handling
Praveen M Jigajinni
 
variablesfinal-170820055428 data type results
variablesfinal-170820055428 data type resultsvariablesfinal-170820055428 data type results
variablesfinal-170820055428 data type results
atifmugheesv
 
Visual Basic Fundamentals
Visual Basic FundamentalsVisual Basic Fundamentals
Visual Basic Fundamentals
DivyaR219113
 
Chapter 2.datatypes and operators
Chapter 2.datatypes and operatorsChapter 2.datatypes and operators
Chapter 2.datatypes and operators
Jasleen Kaur (Chandigarh University)
 
cassignmentii-170424105623.pdf
cassignmentii-170424105623.pdfcassignmentii-170424105623.pdf
cassignmentii-170424105623.pdf
YRABHI
 
C language Unit 2 Slides, UPTU C language
C language Unit 2 Slides, UPTU C languageC language Unit 2 Slides, UPTU C language
C language Unit 2 Slides, UPTU C language
Rakesh Roshan
 
C the basic concepts
C the basic conceptsC the basic concepts
C the basic concepts
Abhinav Vatsa
 
java Basic Programming Needs
java Basic Programming Needsjava Basic Programming Needs
java Basic Programming Needs
Raja Sekhar
 
5-Lec - Datatypes.ppt
5-Lec - Datatypes.ppt5-Lec - Datatypes.ppt
5-Lec - Datatypes.ppt
AqeelAbbas94
 
Module 1:Introduction
Module 1:IntroductionModule 1:Introduction
Module 1:Introduction
nikshaikh786
 
Java chapter 2
Java chapter 2Java chapter 2
Java chapter 2
Abdii Rashid
 
FP 201 Unit 2 - Part 2
FP 201 Unit 2 - Part 2FP 201 Unit 2 - Part 2
FP 201 Unit 2 - Part 2
rohassanie
 
Introduction to c
Introduction to cIntroduction to c
Introduction to c
sunila tharagaturi
 
Unit 1 introduction to visual basic programming
Unit 1 introduction to visual basic programmingUnit 1 introduction to visual basic programming
Unit 1 introduction to visual basic programming
Abha Damani
 
Problem Solving Techniques
Problem Solving TechniquesProblem Solving Techniques
Problem Solving Techniques
valarpink
 
Python
PythonPython
Lesson 4 Basic Programming Constructs.pptx
Lesson 4 Basic Programming Constructs.pptxLesson 4 Basic Programming Constructs.pptx
Lesson 4 Basic Programming Constructs.pptx
John Burca
 
Chapter 2 basic element of programming
Chapter 2 basic element of programming Chapter 2 basic element of programming
Chapter 2 basic element of programming
Zul Aiman
 
Introduction to c
Introduction to cIntroduction to c
Introduction to c
Ajeet Kumar
 

Similar to Chap 2(const var-datatype) (20)

PSPC--UNIT-2.pdf
PSPC--UNIT-2.pdfPSPC--UNIT-2.pdf
PSPC--UNIT-2.pdf
 
Data Handling
Data HandlingData Handling
Data Handling
 
variablesfinal-170820055428 data type results
variablesfinal-170820055428 data type resultsvariablesfinal-170820055428 data type results
variablesfinal-170820055428 data type results
 
Visual Basic Fundamentals
Visual Basic FundamentalsVisual Basic Fundamentals
Visual Basic Fundamentals
 
Chapter 2.datatypes and operators
Chapter 2.datatypes and operatorsChapter 2.datatypes and operators
Chapter 2.datatypes and operators
 
cassignmentii-170424105623.pdf
cassignmentii-170424105623.pdfcassignmentii-170424105623.pdf
cassignmentii-170424105623.pdf
 
C language Unit 2 Slides, UPTU C language
C language Unit 2 Slides, UPTU C languageC language Unit 2 Slides, UPTU C language
C language Unit 2 Slides, UPTU C language
 
C the basic concepts
C the basic conceptsC the basic concepts
C the basic concepts
 
java Basic Programming Needs
java Basic Programming Needsjava Basic Programming Needs
java Basic Programming Needs
 
5-Lec - Datatypes.ppt
5-Lec - Datatypes.ppt5-Lec - Datatypes.ppt
5-Lec - Datatypes.ppt
 
Module 1:Introduction
Module 1:IntroductionModule 1:Introduction
Module 1:Introduction
 
Java chapter 2
Java chapter 2Java chapter 2
Java chapter 2
 
FP 201 Unit 2 - Part 2
FP 201 Unit 2 - Part 2FP 201 Unit 2 - Part 2
FP 201 Unit 2 - Part 2
 
Introduction to c
Introduction to cIntroduction to c
Introduction to c
 
Unit 1 introduction to visual basic programming
Unit 1 introduction to visual basic programmingUnit 1 introduction to visual basic programming
Unit 1 introduction to visual basic programming
 
Problem Solving Techniques
Problem Solving TechniquesProblem Solving Techniques
Problem Solving Techniques
 
Python
PythonPython
Python
 
Lesson 4 Basic Programming Constructs.pptx
Lesson 4 Basic Programming Constructs.pptxLesson 4 Basic Programming Constructs.pptx
Lesson 4 Basic Programming Constructs.pptx
 
Chapter 2 basic element of programming
Chapter 2 basic element of programming Chapter 2 basic element of programming
Chapter 2 basic element of programming
 
Introduction to c
Introduction to cIntroduction to c
Introduction to c
 

More from Bangabandhu Sheikh Mujibur Rahman Science and Technology University

Antenna (2)
Antenna (2)Antenna (2)
Voltage suppler..
Voltage suppler..Voltage suppler..
Number system
Number systemNumber system
Chapter 15
Chapter 15Chapter 15
Chap 13(dynamic memory allocation)
Chap 13(dynamic memory allocation)Chap 13(dynamic memory allocation)
Chap 12(files)
Chap 12(files)Chap 12(files)
Chap 11(pointers)
Chap 11(pointers)Chap 11(pointers)
Chap 10(structure and unions)
Chap 10(structure and unions)Chap 10(structure and unions)
Chap 9(functions)
Chap 9(functions)Chap 9(functions)
Chap 8(strings)
Chap 8(strings)Chap 8(strings)
Chap 7(array)
Chap 7(array)Chap 7(array)
Chap 6(decision making-looping)
Chap 6(decision making-looping)Chap 6(decision making-looping)
Chap 5(decision making-branching)
Chap 5(decision making-branching)Chap 5(decision making-branching)
Chap 3(operator expression)
Chap 3(operator expression)Chap 3(operator expression)
Computer hardware ppt1
Computer hardware ppt1Computer hardware ppt1
# Operating system
# Operating system# Operating system
Magnetism 3
Magnetism 3Magnetism 3
Magnetism 2
Magnetism 2Magnetism 2
2. sinusoidal waves
2. sinusoidal waves2. sinusoidal waves
Magnetism 1
Magnetism 1Magnetism 1

More from Bangabandhu Sheikh Mujibur Rahman Science and Technology University (20)

Antenna (2)
Antenna (2)Antenna (2)
Antenna (2)
 
Voltage suppler..
Voltage suppler..Voltage suppler..
Voltage suppler..
 
Number system
Number systemNumber system
Number system
 
Chapter 15
Chapter 15Chapter 15
Chapter 15
 
Chap 13(dynamic memory allocation)
Chap 13(dynamic memory allocation)Chap 13(dynamic memory allocation)
Chap 13(dynamic memory allocation)
 
Chap 12(files)
Chap 12(files)Chap 12(files)
Chap 12(files)
 
Chap 11(pointers)
Chap 11(pointers)Chap 11(pointers)
Chap 11(pointers)
 
Chap 10(structure and unions)
Chap 10(structure and unions)Chap 10(structure and unions)
Chap 10(structure and unions)
 
Chap 9(functions)
Chap 9(functions)Chap 9(functions)
Chap 9(functions)
 
Chap 8(strings)
Chap 8(strings)Chap 8(strings)
Chap 8(strings)
 
Chap 7(array)
Chap 7(array)Chap 7(array)
Chap 7(array)
 
Chap 6(decision making-looping)
Chap 6(decision making-looping)Chap 6(decision making-looping)
Chap 6(decision making-looping)
 
Chap 5(decision making-branching)
Chap 5(decision making-branching)Chap 5(decision making-branching)
Chap 5(decision making-branching)
 
Chap 3(operator expression)
Chap 3(operator expression)Chap 3(operator expression)
Chap 3(operator expression)
 
Computer hardware ppt1
Computer hardware ppt1Computer hardware ppt1
Computer hardware ppt1
 
# Operating system
# Operating system# Operating system
# Operating system
 
Magnetism 3
Magnetism 3Magnetism 3
Magnetism 3
 
Magnetism 2
Magnetism 2Magnetism 2
Magnetism 2
 
2. sinusoidal waves
2. sinusoidal waves2. sinusoidal waves
2. sinusoidal waves
 
Magnetism 1
Magnetism 1Magnetism 1
Magnetism 1
 

Recently uploaded

World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024
ak6969907
 
Advantages and Disadvantages of CMS from an SEO Perspective
Advantages and Disadvantages of CMS from an SEO PerspectiveAdvantages and Disadvantages of CMS from an SEO Perspective
Advantages and Disadvantages of CMS from an SEO Perspective
Krisztián Száraz
 
Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
Nicholas Montgomery
 
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective UpskillingYour Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Excellence Foundation for South Sudan
 
Azure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHatAzure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHat
Scholarhat
 
How to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold MethodHow to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold Method
Celine George
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
camakaiclarkmusic
 
MATATAG CURRICULUM: ASSESSING THE READINESS OF ELEM. PUBLIC SCHOOL TEACHERS I...
MATATAG CURRICULUM: ASSESSING THE READINESS OF ELEM. PUBLIC SCHOOL TEACHERS I...MATATAG CURRICULUM: ASSESSING THE READINESS OF ELEM. PUBLIC SCHOOL TEACHERS I...
MATATAG CURRICULUM: ASSESSING THE READINESS OF ELEM. PUBLIC SCHOOL TEACHERS I...
NelTorrente
 
Liberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdfLiberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdf
WaniBasim
 
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
National Information Standards Organization (NISO)
 
How to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRMHow to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRM
Celine George
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
Jean Carlos Nunes Paixão
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
heathfieldcps1
 
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptxChapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Dr. Vinod Kumar Kanvaria
 
A Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdfA Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdf
Jean Carlos Nunes Paixão
 
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdfANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
Priyankaranawat4
 
MARY JANE WILSON, A “BOA MÃE” .
MARY JANE WILSON, A “BOA MÃE”           .MARY JANE WILSON, A “BOA MÃE”           .
MARY JANE WILSON, A “BOA MÃE” .
Colégio Santa Teresinha
 
Top five deadliest dog breeds in America
Top five deadliest dog breeds in AmericaTop five deadliest dog breeds in America
Top five deadliest dog breeds in America
Bisnar Chase Personal Injury Attorneys
 
writing about opinions about Australia the movie
writing about opinions about Australia the moviewriting about opinions about Australia the movie
writing about opinions about Australia the movie
Nicholas Montgomery
 

Recently uploaded (20)

World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024
 
Advantages and Disadvantages of CMS from an SEO Perspective
Advantages and Disadvantages of CMS from an SEO PerspectiveAdvantages and Disadvantages of CMS from an SEO Perspective
Advantages and Disadvantages of CMS from an SEO Perspective
 
Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
 
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective UpskillingYour Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective Upskilling
 
Azure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHatAzure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHat
 
How to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold MethodHow to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold Method
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
 
MATATAG CURRICULUM: ASSESSING THE READINESS OF ELEM. PUBLIC SCHOOL TEACHERS I...
MATATAG CURRICULUM: ASSESSING THE READINESS OF ELEM. PUBLIC SCHOOL TEACHERS I...MATATAG CURRICULUM: ASSESSING THE READINESS OF ELEM. PUBLIC SCHOOL TEACHERS I...
MATATAG CURRICULUM: ASSESSING THE READINESS OF ELEM. PUBLIC SCHOOL TEACHERS I...
 
Liberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdfLiberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdf
 
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
 
How to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRMHow to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRM
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
 
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptxChapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
 
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
 
A Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdfA Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdf
 
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdfANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
 
MARY JANE WILSON, A “BOA MÃE” .
MARY JANE WILSON, A “BOA MÃE”           .MARY JANE WILSON, A “BOA MÃE”           .
MARY JANE WILSON, A “BOA MÃE” .
 
Top five deadliest dog breeds in America
Top five deadliest dog breeds in AmericaTop five deadliest dog breeds in America
Top five deadliest dog breeds in America
 
writing about opinions about Australia the movie
writing about opinions about Australia the moviewriting about opinions about Australia the movie
writing about opinions about Australia the movie
 

Chap 2(const var-datatype)

  • 1. Constants, Variables and Data Types Topics  Token, Keyword, Identifier  Constant, Variable  Data types
  • 2. Token and Keyword  Token- In a C program the smallest individual units are known as C tokens. C has six types of tokens. 1. Keyword- float, int, while 2. Identifier- main, amount 3. Constant- 10.5, 10 4. String- “ABC”, “Khulna” 5. Special symbol- [ ], { } 6. Operator- +,-,*  Keyword- Keywords are the reserve words which have fixed meanings and that cannot be changed. Ex- float, double, while, char, do, if, else
  • 3. Identifier, Constant  Identifier- Identifiers refer to the names of variables, functions and arrays.  Constant- Constants in C refer to fixed values do not change during the execution of a program. Ex- 123, -0.75, ‘X’, “CSE”  Process of declaring constant: 1. #define: #define const_name value Ex: #define MAX 100 2. const: const data_type const_name = value; Ex: const int MAX=100;
  • 4. Variable  Variable- A variable is a data name that may be used to store data value. A variable may take different values at different times during execution.  Rules of variable name: 1. It must begin with a letter. Some systems permit underscore as the first character. 2. ANSI standard recognizes a length of 31 characters. But it should normally in between 8 char. 3. Uppercase and lowercase are different. 4. Variable name should not be a keyword. 5. White space is not allowed.
  • 5. Data Types  Primary data types- character, Integer, Float, Double  User-defined data types- Structure, Union, Class, Enumeration  Derived data types- Array, Function, Pointer, Reference
  • 6. Modifier or Qualifier  Modifier- The keyword like short, long, unsigned, signed can change the data storage capacity of the variable. So they are called modifier or qualifier.  Type Size (bits) Range char 8 -128 to 127 int or short int 16 -32768 to 32767 unsigned int 16 0 to 65535 short int 8 -128 to 127 long int 32 -2147483648 to 2147483648 float 32 3.4E-38 to 3.4E+38 double 64 1.7E-308 to 1.7E+308 long double 80 3.4E-4932 to 3.4E+4932
  • 7. Variable Declaration  Declaration does two things: 1. It tells the compiler what the variable name is. 2. It specifies what type of data the variable will hold.  The declaration of variables must be done before they are used in the program.  Rule: Data_type Var_name;  Ex: int x, y; float area;
  • 8. Assigning values to Variables  Rule: var_name = constant; Ex: balance = 1277.50; ch = ‘Y’;  C permits multiple assignments in one line. Ex: length=10; height=5;  It is also possible to assign a value to a variable at the time of variable declaration. Ex: int x = 100;  C permits the initialization of more than one variables in one statement using multiple assignment operators. Ex: x = y = z = 100;