SlideShare uma empresa Scribd logo
1 de 22
Baixar para ler offline
Team Emertxe
Pre-Processing
Assignment 1
Assignment 1
Assignment 1
WAP to define a macro SIZEOF(x),without using sizeof
operator.
Assignment 1
WAP to define a macro SIZEOF(x),without using sizeof
operator.
Input:
Assignment 1
WAP to define a macro SIZEOF(x),without using sizeof
operator.
Input: None
Assignment 1
WAP to define a macro SIZEOF(x),without using sizeof
operator.
Input: None
Output:
Assignment 1
WAP to define a macro SIZEOF(x),without using sizeof
operator.
Input: None
Output: Print size of different data types
How will you find the size of an data type without using
sizeof operator?
Assignment 1
How will you find the size of an data type without using
sizeof operator?
 You can make use of address of respective variable.
 Example: int x = 5;
Assignment 1
5
x
1000 1004
How will you find the size of an data type without using
sizeof operator?
 You can make use of address of respective variable.
 Example: int x = 5;
 Difference of 1004 and 1000 is 4, so, use these addresses to get
the size of the data type i.e., (&x+1) – (&x)
Assignment 1
x
1000 1004
5
 Example: int x = 5;
 Now, what is the output when you do (&x+1) – (&x) ?
&x+1 - &x = 1000 + 1 * sizeof(int) – 1000
= 1000 + 1 * 4 – 1000
= 1004 – 1000
= 4 / sizeof(int)
= 4 / 4
&x+1 - &x = 1
 But, we want 4 right? So, what needs to be done to get 4?
Assignment 1
x
1000 1004
5
 Example: int x = 5;
 Now, what is the output when you do (&x+1) – (&x) ?
&x+1 - &x = 1000 + 1 * sizeof(int) – 1000
= 1000 + 1 * 4 – 1000
= 1004 – 1000
= 4 / sizeof(int) <- Replace sizeof(char)
= 4 / 1
&x+1 - &x = 4
 How can we change it to char?
Assignment 1
x
1000 1004
5
 Example: int x = 5;
 Now, what is the output when you do (&x+1) – (&x) ?
&x+1 - &x = 1000 + 1 * sizeof(int) – 1000
= 1000 + 1 * 4 – 1000
= 1004 – 1000
= 4 / sizeof(int) <- Replace sizeof(char)
= 4 / 1
&x+1 - &x = 4
 Typecast: (char *)(&x+1) – (char *)(&x)
Assignment 1
x
1000 1004
5
Sample execution:-
Assignment 1
Sample execution:-
Assignment 1
Assignment 1
Pre-requisites:-
Assignment 1
Pre-requisites:-
⮚ Macros
Assignment 1
Pre-requisites:-
⮚ Macros
⮚ Pointers
Assignment 1
Pre-requisites:-
⮚ Macros
⮚ Pointers
Objective:-
Assignment 1
Pre-requisites:-
⮚ Macros
⮚ Pointers
Objective:-
⮚ To understand the concepts of Macros in preprocessing
Team Emertxe
Thank you

Mais conteúdo relacionado

Semelhante a 01_sizeof.pdf

Square roots, decimals & number system
Square roots, decimals & number systemSquare roots, decimals & number system
Square roots, decimals & number systemDr. Trilok Kumar Jain
 
Square roots, decimals & number system
Square roots, decimals & number systemSquare roots, decimals & number system
Square roots, decimals & number systemDr. Trilok Kumar Jain
 
Square roots, decimals & number system
Square roots, decimals & number systemSquare roots, decimals & number system
Square roots, decimals & number systemDr. Trilok Kumar Jain
 
Lec2_cont.pptx galgotias University questions
Lec2_cont.pptx galgotias University questionsLec2_cont.pptx galgotias University questions
Lec2_cont.pptx galgotias University questionsYashJain47002
 
08-09 Chapter numerical integration
08-09  Chapter numerical integration 08-09  Chapter numerical integration
08-09 Chapter numerical integration Dr. Mohammed Danish
 
Basic concept of MATLAB.ppt
Basic concept of MATLAB.pptBasic concept of MATLAB.ppt
Basic concept of MATLAB.pptaliraza2732
 
MATH133 UNIT 2 Quadratic EquationsIndividual Project Assignment.docx
MATH133 UNIT 2 Quadratic EquationsIndividual Project Assignment.docxMATH133 UNIT 2 Quadratic EquationsIndividual Project Assignment.docx
MATH133 UNIT 2 Quadratic EquationsIndividual Project Assignment.docxandreecapon
 
Section 4.6 And 4.9: Rational Numbers and Scientific Notation
Section 4.6 And 4.9: Rational Numbers and Scientific NotationSection 4.6 And 4.9: Rational Numbers and Scientific Notation
Section 4.6 And 4.9: Rational Numbers and Scientific NotationJessca Lundin
 
Taylor and maclaurian series
Taylor and maclaurian seriesTaylor and maclaurian series
Taylor and maclaurian seriesNishant Patel
 
Csci101 lect01 first_program
Csci101 lect01 first_programCsci101 lect01 first_program
Csci101 lect01 first_programElsayed Hemayed
 
Introduction To TensorFlow | Deep Learning Using TensorFlow | TensorFlow Tuto...
Introduction To TensorFlow | Deep Learning Using TensorFlow | TensorFlow Tuto...Introduction To TensorFlow | Deep Learning Using TensorFlow | TensorFlow Tuto...
Introduction To TensorFlow | Deep Learning Using TensorFlow | TensorFlow Tuto...Edureka!
 
2. data types, variables and operators
2. data types, variables and operators2. data types, variables and operators
2. data types, variables and operatorsPhD Research Scholar
 
Finding root of equation (numarical method)
Finding root of equation (numarical method)Finding root of equation (numarical method)
Finding root of equation (numarical method)Rajan Thakkar
 
Demystifying the Bias-Variance Tradeoff
Demystifying the Bias-Variance TradeoffDemystifying the Bias-Variance Tradeoff
Demystifying the Bias-Variance TradeoffAshwin Rao
 
1.2 algebraic expressions and models
1.2 algebraic expressions and models1.2 algebraic expressions and models
1.2 algebraic expressions and modelsfthrower
 
Erlang assembly
Erlang assemblyErlang assembly
Erlang assemblyrstudnicki
 

Semelhante a 01_sizeof.pdf (20)

Square roots, decimals & number system
Square roots, decimals & number systemSquare roots, decimals & number system
Square roots, decimals & number system
 
Square roots, decimals & number system
Square roots, decimals & number systemSquare roots, decimals & number system
Square roots, decimals & number system
 
Square roots, decimals & number system
Square roots, decimals & number systemSquare roots, decimals & number system
Square roots, decimals & number system
 
R for Statistical Computing
R for Statistical ComputingR for Statistical Computing
R for Statistical Computing
 
L06
L06L06
L06
 
Lec2_cont.pptx galgotias University questions
Lec2_cont.pptx galgotias University questionsLec2_cont.pptx galgotias University questions
Lec2_cont.pptx galgotias University questions
 
08-09 Chapter numerical integration
08-09  Chapter numerical integration 08-09  Chapter numerical integration
08-09 Chapter numerical integration
 
Basic concept of MATLAB.ppt
Basic concept of MATLAB.pptBasic concept of MATLAB.ppt
Basic concept of MATLAB.ppt
 
MATH133 UNIT 2 Quadratic EquationsIndividual Project Assignment.docx
MATH133 UNIT 2 Quadratic EquationsIndividual Project Assignment.docxMATH133 UNIT 2 Quadratic EquationsIndividual Project Assignment.docx
MATH133 UNIT 2 Quadratic EquationsIndividual Project Assignment.docx
 
Section 4.6 And 4.9: Rational Numbers and Scientific Notation
Section 4.6 And 4.9: Rational Numbers and Scientific NotationSection 4.6 And 4.9: Rational Numbers and Scientific Notation
Section 4.6 And 4.9: Rational Numbers and Scientific Notation
 
Taylor and maclaurian series
Taylor and maclaurian seriesTaylor and maclaurian series
Taylor and maclaurian series
 
Csci101 lect01 first_program
Csci101 lect01 first_programCsci101 lect01 first_program
Csci101 lect01 first_program
 
Introduction To TensorFlow | Deep Learning Using TensorFlow | TensorFlow Tuto...
Introduction To TensorFlow | Deep Learning Using TensorFlow | TensorFlow Tuto...Introduction To TensorFlow | Deep Learning Using TensorFlow | TensorFlow Tuto...
Introduction To TensorFlow | Deep Learning Using TensorFlow | TensorFlow Tuto...
 
mc-ty-polynomial-2009-1.pdf
mc-ty-polynomial-2009-1.pdfmc-ty-polynomial-2009-1.pdf
mc-ty-polynomial-2009-1.pdf
 
2. data types, variables and operators
2. data types, variables and operators2. data types, variables and operators
2. data types, variables and operators
 
Finding root of equation (numarical method)
Finding root of equation (numarical method)Finding root of equation (numarical method)
Finding root of equation (numarical method)
 
Array-part1
Array-part1Array-part1
Array-part1
 
Demystifying the Bias-Variance Tradeoff
Demystifying the Bias-Variance TradeoffDemystifying the Bias-Variance Tradeoff
Demystifying the Bias-Variance Tradeoff
 
1.2 algebraic expressions and models
1.2 algebraic expressions and models1.2 algebraic expressions and models
1.2 algebraic expressions and models
 
Erlang assembly
Erlang assemblyErlang assembly
Erlang assembly
 

Mais de Emertxe Information Technologies Pvt Ltd

Mais de Emertxe Information Technologies Pvt Ltd (20)

premium post (1).pdf
premium post (1).pdfpremium post (1).pdf
premium post (1).pdf
 
Career Transition (1).pdf
Career Transition (1).pdfCareer Transition (1).pdf
Career Transition (1).pdf
 
10_isxdigit.pdf
10_isxdigit.pdf10_isxdigit.pdf
10_isxdigit.pdf
 
01_student_record.pdf
01_student_record.pdf01_student_record.pdf
01_student_record.pdf
 
02_swap.pdf
02_swap.pdf02_swap.pdf
02_swap.pdf
 
07_product_matrix.pdf
07_product_matrix.pdf07_product_matrix.pdf
07_product_matrix.pdf
 
06_sort_names.pdf
06_sort_names.pdf06_sort_names.pdf
06_sort_names.pdf
 
05_fragments.pdf
05_fragments.pdf05_fragments.pdf
05_fragments.pdf
 
04_magic_square.pdf
04_magic_square.pdf04_magic_square.pdf
04_magic_square.pdf
 
03_endianess.pdf
03_endianess.pdf03_endianess.pdf
03_endianess.pdf
 
02_variance.pdf
02_variance.pdf02_variance.pdf
02_variance.pdf
 
01_memory_manager.pdf
01_memory_manager.pdf01_memory_manager.pdf
01_memory_manager.pdf
 
09_nrps.pdf
09_nrps.pdf09_nrps.pdf
09_nrps.pdf
 
11_pangram.pdf
11_pangram.pdf11_pangram.pdf
11_pangram.pdf
 
10_combinations.pdf
10_combinations.pdf10_combinations.pdf
10_combinations.pdf
 
08_squeeze.pdf
08_squeeze.pdf08_squeeze.pdf
08_squeeze.pdf
 
07_strtok.pdf
07_strtok.pdf07_strtok.pdf
07_strtok.pdf
 
06_reverserec.pdf
06_reverserec.pdf06_reverserec.pdf
06_reverserec.pdf
 
05_reverseiter.pdf
05_reverseiter.pdf05_reverseiter.pdf
05_reverseiter.pdf
 
04_itoa.pdf
04_itoa.pdf04_itoa.pdf
04_itoa.pdf
 

Último

JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...anjaliyadav012327
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room servicediscovermytutordmt
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
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
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfchloefrazer622
 
The byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptxThe byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptxShobhayan Kirtania
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpinRaunakKeshri1
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
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
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 

Último (20)

Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room service
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
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
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdf
 
The byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptxThe byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptx
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
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
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 

01_sizeof.pdf