SlideShare a Scribd company logo
Answer
1. Benefits of separating header files from the cpp files are:
a. reusability, as header files are most commonly used files included in the cpp files, they are
inclusively used for almost all the functions. To avoid mentioning them again and again in each
and every files in a project they are separated from all the cpp files and are clubed together in a
single header file which is used during the execution of the project and and is linked with the
other cpp files during the runtime.
b. compilation becomes faster, as linking will be needed only once unlike each time for each cpp
file
c. organized code, header file acts similar to book index and helps you to locate specific function
d. helps in separating interface from implementation
2.
It's not that a programmer should minimize the use of #include in header file, they need to be
careful while using #include in the header file and always use them within the #ifnotdefined and
#ifnotdefinedend block in order to avoid clash and error of multiple inclusion.
3.
include guard... guard against multiple incidental includes
it is needed to prevent multiple inclusion error
4.
const is the keyword for making any value/element constant.
Example:
const int a = 5;
const int *p;
etc.
Solution
Answer
1. Benefits of separating header files from the cpp files are:
a. reusability, as header files are most commonly used files included in the cpp files, they are
inclusively used for almost all the functions. To avoid mentioning them again and again in each
and every files in a project they are separated from all the cpp files and are clubed together in a
single header file which is used during the execution of the project and and is linked with the
other cpp files during the runtime.
b. compilation becomes faster, as linking will be needed only once unlike each time for each cpp
file
c. organized code, header file acts similar to book index and helps you to locate specific function
d. helps in separating interface from implementation
2.
It's not that a programmer should minimize the use of #include in header file, they need to be
careful while using #include in the header file and always use them within the #ifnotdefined and
#ifnotdefinedend block in order to avoid clash and error of multiple inclusion.
3.
include guard... guard against multiple incidental includes
it is needed to prevent multiple inclusion error
4.
const is the keyword for making any value/element constant.
Example:
const int a = 5;
const int *p;
etc.

More Related Content

PPTX
google sites coding & programming language.pptx
PPTX
blogger coding & programming language.pptx
PDF
live journal coding & programming language.pdf
PDF
blogger coding & programming language.pdf
PPTX
live journal coding & programming language.pptx
PPTX
C language header files
PDF
C- language Lecture 8
PPT
Lecture 21 - Preprocessor and Header File
google sites coding & programming language.pptx
blogger coding & programming language.pptx
live journal coding & programming language.pdf
blogger coding & programming language.pdf
live journal coding & programming language.pptx
C language header files
C- language Lecture 8
Lecture 21 - Preprocessor and Header File

Similar to Answer1. Benefits of separating header files from the cpp files ar.pdf (20)

PDF
StdAfx.h for Novices
PDF
Introduction To C++ programming and its basic concepts
PDF
6 preprocessor macro header
PPT
Multidiscipline Collaboration On A Single Central File
PPT
cppProgramStructure.ppt
PPTX
INTRODUCTION TO C LANGUAGE.pptx
PPTX
computer networksssssssssssssssssssssssssssss.pptx
PPTX
Oosd lecture unit 4 ppt introduction part
PPTX
Unit 2 l1
DOCX
Explain the motivation behind using a header file for a C program-Solu.docx
PPTX
C programming
PDF
Cp week _2.
PPTX
Preprocesser in c++ by thanveer danish
DOCX
i Encapsulation} ra te compilation is to achieve encapsulation- How to.docx
ODP
[EclipseCon France 2017] Eclipse Platform Generic Editor
DOCX
Whats a header- Whats a source-code file- Discuss the purpose of each-.docx
PDF
Ansible at FOSDEM (Ansible Dublin, 2016)
PPTX
Chapter vvxxxxxxxxxxx1 - Part 1 (3).pptx
PDF
inline function
PPT
StdAfx.h for Novices
Introduction To C++ programming and its basic concepts
6 preprocessor macro header
Multidiscipline Collaboration On A Single Central File
cppProgramStructure.ppt
INTRODUCTION TO C LANGUAGE.pptx
computer networksssssssssssssssssssssssssssss.pptx
Oosd lecture unit 4 ppt introduction part
Unit 2 l1
Explain the motivation behind using a header file for a C program-Solu.docx
C programming
Cp week _2.
Preprocesser in c++ by thanveer danish
i Encapsulation} ra te compilation is to achieve encapsulation- How to.docx
[EclipseCon France 2017] Eclipse Platform Generic Editor
Whats a header- Whats a source-code file- Discuss the purpose of each-.docx
Ansible at FOSDEM (Ansible Dublin, 2016)
Chapter vvxxxxxxxxxxx1 - Part 1 (3).pptx
inline function
Ad

More from ANANDSHOE (20)

PDF
S1 = S0 is fluorescence. S1 = T1 is intersyste.pdf
PDF
let x be concentration of SO2 and O2 2x+x=6.4 x=2.pdf
PDF
isotopes have same atomic number but different ma.pdf
PDF
i ) Lead orthophosphate ii) dinitrogen pentasulfi.pdf
PDF
TThe function is increasing in the interval [1,5)The function is n.pdf
PDF
This is the code of shellsortvoid Shellsort( ElementType A[ ], int.pdf
PDF
The balanced ionic Equation in basic medium is H2O + 2 CrO 42 --.pdf
PDF
The acidic hydrogen attaches to the carbon bonded to the least alkyl.pdf
PDF
Propanoic acid will react (in an acid-base reaction) with aqueous ba.pdf
PDF
Pollinationis theprocessby whichpollenis transferred in the reproduc.pdf
PDF
A.B.(C)Journal Entries for the year 2014DateAccount title and ex.pdf
PDF
c) increases the melting point .pdf
PDF
fjgySolutionfjgy.pdf
PDF
G is Hamiltonian graph.Hence a path exists which visits each verte.pdf
PDF
Enumerable A set is one whose members can be enumerated is called e.pdf
PDF
C.There is some evidence against H0, and a study using a larger samp.pdf
PDF
Bohr orbits have fixed sizes and fixed energiesSolutionBohr or.pdf
PDF
c) At high altitudes the partial pressure of carbon dioxide as well .pdf
PDF
AnswerFrogs have a pair of large eyes in the head which help in e.pdf
PDF
a) can be anionic b) can be polydentate c) can be Lewis base d.pdf
S1 = S0 is fluorescence. S1 = T1 is intersyste.pdf
let x be concentration of SO2 and O2 2x+x=6.4 x=2.pdf
isotopes have same atomic number but different ma.pdf
i ) Lead orthophosphate ii) dinitrogen pentasulfi.pdf
TThe function is increasing in the interval [1,5)The function is n.pdf
This is the code of shellsortvoid Shellsort( ElementType A[ ], int.pdf
The balanced ionic Equation in basic medium is H2O + 2 CrO 42 --.pdf
The acidic hydrogen attaches to the carbon bonded to the least alkyl.pdf
Propanoic acid will react (in an acid-base reaction) with aqueous ba.pdf
Pollinationis theprocessby whichpollenis transferred in the reproduc.pdf
A.B.(C)Journal Entries for the year 2014DateAccount title and ex.pdf
c) increases the melting point .pdf
fjgySolutionfjgy.pdf
G is Hamiltonian graph.Hence a path exists which visits each verte.pdf
Enumerable A set is one whose members can be enumerated is called e.pdf
C.There is some evidence against H0, and a study using a larger samp.pdf
Bohr orbits have fixed sizes and fixed energiesSolutionBohr or.pdf
c) At high altitudes the partial pressure of carbon dioxide as well .pdf
AnswerFrogs have a pair of large eyes in the head which help in e.pdf
a) can be anionic b) can be polydentate c) can be Lewis base d.pdf
Ad

Recently uploaded (20)

PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PDF
Classroom Observation Tools for Teachers
PDF
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PDF
Computing-Curriculum for Schools in Ghana
PDF
Weekly quiz Compilation Jan -July 25.pdf
PDF
GENETICS IN BIOLOGY IN SECONDARY LEVEL FORM 3
PPTX
master seminar digital applications in india
PPTX
human mycosis Human fungal infections are called human mycosis..pptx
PPTX
Pharma ospi slides which help in ospi learning
PPTX
Lesson notes of climatology university.
PDF
Complications of Minimal Access Surgery at WLH
PPTX
Cell Types and Its function , kingdom of life
PPTX
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
PPTX
GDM (1) (1).pptx small presentation for students
PDF
Trump Administration's workforce development strategy
PPTX
Introduction-to-Literarature-and-Literary-Studies-week-Prelim-coverage.pptx
PDF
A systematic review of self-coping strategies used by university students to ...
PDF
Yogi Goddess Pres Conference Studio Updates
PDF
RTP_AR_KS1_Tutor's Guide_English [FOR REPRODUCTION].pdf
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
Classroom Observation Tools for Teachers
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
Computing-Curriculum for Schools in Ghana
Weekly quiz Compilation Jan -July 25.pdf
GENETICS IN BIOLOGY IN SECONDARY LEVEL FORM 3
master seminar digital applications in india
human mycosis Human fungal infections are called human mycosis..pptx
Pharma ospi slides which help in ospi learning
Lesson notes of climatology university.
Complications of Minimal Access Surgery at WLH
Cell Types and Its function , kingdom of life
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
GDM (1) (1).pptx small presentation for students
Trump Administration's workforce development strategy
Introduction-to-Literarature-and-Literary-Studies-week-Prelim-coverage.pptx
A systematic review of self-coping strategies used by university students to ...
Yogi Goddess Pres Conference Studio Updates
RTP_AR_KS1_Tutor's Guide_English [FOR REPRODUCTION].pdf

Answer1. Benefits of separating header files from the cpp files ar.pdf

  • 1. Answer 1. Benefits of separating header files from the cpp files are: a. reusability, as header files are most commonly used files included in the cpp files, they are inclusively used for almost all the functions. To avoid mentioning them again and again in each and every files in a project they are separated from all the cpp files and are clubed together in a single header file which is used during the execution of the project and and is linked with the other cpp files during the runtime. b. compilation becomes faster, as linking will be needed only once unlike each time for each cpp file c. organized code, header file acts similar to book index and helps you to locate specific function d. helps in separating interface from implementation 2. It's not that a programmer should minimize the use of #include in header file, they need to be careful while using #include in the header file and always use them within the #ifnotdefined and #ifnotdefinedend block in order to avoid clash and error of multiple inclusion. 3. include guard... guard against multiple incidental includes it is needed to prevent multiple inclusion error 4. const is the keyword for making any value/element constant. Example: const int a = 5; const int *p; etc. Solution Answer 1. Benefits of separating header files from the cpp files are: a. reusability, as header files are most commonly used files included in the cpp files, they are inclusively used for almost all the functions. To avoid mentioning them again and again in each and every files in a project they are separated from all the cpp files and are clubed together in a single header file which is used during the execution of the project and and is linked with the other cpp files during the runtime. b. compilation becomes faster, as linking will be needed only once unlike each time for each cpp
  • 2. file c. organized code, header file acts similar to book index and helps you to locate specific function d. helps in separating interface from implementation 2. It's not that a programmer should minimize the use of #include in header file, they need to be careful while using #include in the header file and always use them within the #ifnotdefined and #ifnotdefinedend block in order to avoid clash and error of multiple inclusion. 3. include guard... guard against multiple incidental includes it is needed to prevent multiple inclusion error 4. const is the keyword for making any value/element constant. Example: const int a = 5; const int *p; etc.