SlideShare a Scribd company logo
1 of 2
Explain the motivation behind using a header file for a C program.
Solution
Motivation behind using header file in c Programming:
Header files contain definitions of functions and variables which can be included into any c
program by using #include.
Compilation speed up and optimization :During compilation of some parts of the code it may
be sufficient to load API interfaces from header files to check correctness of the code used while
defining them.
-2. The motivation for the introduction of header files is type safety. C allows function calls
without forward declaration. Logically speaking using functions without forward declaration is
as harmful as using Macros as compilers has no proper mechanism to validate the type of the
arguments with the parameters. So chances of unresolved linkage errors and runtime failure is
more prominent.
3. Header files are more like data abstraction, you just see the important components and you
don't need to know the background process.
4. To reduce overhead of RAM....the functions or classes defined in these header files are already
compiled so they can be directly used .
5.Including a header allows your code to call functions or methods which are written elsewhere
and which may or may not be a part of your software project/build, but which can be found by
the 'linker' when you are building the software.
6. Header files are mainly used to declare and include the signatures (i.e. function name, return
value and arguments) of your functions in other files. The compiler needs to know these
signatures when compiling and linking your files together.
Explain the motivation behind using a header file for a C program-Solu.docx

More Related Content

Similar to Explain the motivation behind using a header file for a C program-Solu.docx

C language header files
C language header filesC language header files
C language header filesmarar hina
 
C Programming UNIT 1.pptx
C Programming  UNIT 1.pptxC Programming  UNIT 1.pptx
C Programming UNIT 1.pptxMugilvannan11
 
Chapter 13.1.4
Chapter 13.1.4Chapter 13.1.4
Chapter 13.1.4patcha535
 
Dot net interview questions and asnwers
Dot net interview questions and asnwersDot net interview questions and asnwers
Dot net interview questions and asnwerskavinilavuG
 
CS8251_QB_answers.pdf
CS8251_QB_answers.pdfCS8251_QB_answers.pdf
CS8251_QB_answers.pdfvino108206
 
6 preprocessor macro header
6 preprocessor macro header6 preprocessor macro header
6 preprocessor macro headerhasan Mohammad
 
Stnotes doc 5
Stnotes doc 5Stnotes doc 5
Stnotes doc 5Alok Jain
 
Aspect Oriented Programming Through C#.NET
Aspect Oriented Programming Through C#.NETAspect Oriented Programming Through C#.NET
Aspect Oriented Programming Through C#.NETWaqas Tariq
 
Unit-2_Getting Started With ‘C’ Language (3).pptx
Unit-2_Getting Started With ‘C’ Language (3).pptxUnit-2_Getting Started With ‘C’ Language (3).pptx
Unit-2_Getting Started With ‘C’ Language (3).pptxSanketShah544615
 
Basic structure of c programming
Basic structure of c programmingBasic structure of c programming
Basic structure of c programmingTejaswiB4
 
Basic structure of c programming
Basic structure of c programmingBasic structure of c programming
Basic structure of c programmingTejaswiB4
 

Similar to Explain the motivation behind using a header file for a C program-Solu.docx (20)

Embedded C.pptx
Embedded C.pptxEmbedded C.pptx
Embedded C.pptx
 
C language header files
C language header filesC language header files
C language header files
 
Unit-2.pptx
Unit-2.pptxUnit-2.pptx
Unit-2.pptx
 
C Programming UNIT 1.pptx
C Programming  UNIT 1.pptxC Programming  UNIT 1.pptx
C Programming UNIT 1.pptx
 
Chapter 13.1.4
Chapter 13.1.4Chapter 13.1.4
Chapter 13.1.4
 
Dot net interview questions and asnwers
Dot net interview questions and asnwersDot net interview questions and asnwers
Dot net interview questions and asnwers
 
CS8251_QB_answers.pdf
CS8251_QB_answers.pdfCS8251_QB_answers.pdf
CS8251_QB_answers.pdf
 
6 preprocessor macro header
6 preprocessor macro header6 preprocessor macro header
6 preprocessor macro header
 
cakephp UDUYKTHA (1)
cakephp UDUYKTHA (1)cakephp UDUYKTHA (1)
cakephp UDUYKTHA (1)
 
inline function
inline functioninline function
inline function
 
Introduction of C++ By Pawan Thakur
Introduction of C++ By Pawan ThakurIntroduction of C++ By Pawan Thakur
Introduction of C++ By Pawan Thakur
 
Stnotes doc 5
Stnotes doc 5Stnotes doc 5
Stnotes doc 5
 
Learning the C Language
Learning the C LanguageLearning the C Language
Learning the C Language
 
C PROGRAMMING p-2.pdf
C PROGRAMMING p-2.pdfC PROGRAMMING p-2.pdf
C PROGRAMMING p-2.pdf
 
Aspect Oriented Programming Through C#.NET
Aspect Oriented Programming Through C#.NETAspect Oriented Programming Through C#.NET
Aspect Oriented Programming Through C#.NET
 
Unit-2_Getting Started With ‘C’ Language (3).pptx
Unit-2_Getting Started With ‘C’ Language (3).pptxUnit-2_Getting Started With ‘C’ Language (3).pptx
Unit-2_Getting Started With ‘C’ Language (3).pptx
 
Inline functions
Inline functionsInline functions
Inline functions
 
Oops index
Oops indexOops index
Oops index
 
Basic structure of c programming
Basic structure of c programmingBasic structure of c programming
Basic structure of c programming
 
Basic structure of c programming
Basic structure of c programmingBasic structure of c programming
Basic structure of c programming
 

More from james876543264

Astronomy 107- 1- Why does helium fusion require a higher temperature.docx
Astronomy 107- 1- Why does helium fusion require a higher temperature.docxAstronomy 107- 1- Why does helium fusion require a higher temperature.docx
Astronomy 107- 1- Why does helium fusion require a higher temperature.docxjames876543264
 
Astronomers have found dark matter in a variety of environments- Name.docx
Astronomers have found dark matter in a variety of environments- Name.docxAstronomers have found dark matter in a variety of environments- Name.docx
Astronomers have found dark matter in a variety of environments- Name.docxjames876543264
 
Assume that LO and HI have already been assigned as constants with LO.docx
Assume that LO and HI have already been assigned as constants with LO.docxAssume that LO and HI have already been assigned as constants with LO.docx
Assume that LO and HI have already been assigned as constants with LO.docxjames876543264
 
AS1- Four Condition of Deadloc- show that the four conditions of deadl.docx
AS1- Four Condition of Deadloc- show that the four conditions of deadl.docxAS1- Four Condition of Deadloc- show that the four conditions of deadl.docx
AS1- Four Condition of Deadloc- show that the four conditions of deadl.docxjames876543264
 
As we know- total ownership is not a requirement for consolidation- A.docx
As we know- total ownership is not a requirement for consolidation- A.docxAs we know- total ownership is not a requirement for consolidation- A.docx
As we know- total ownership is not a requirement for consolidation- A.docxjames876543264
 
Asset Depreciation 2 2 unread replies- 2 2 replies- Answer each of the.docx
Asset Depreciation 2 2 unread replies- 2 2 replies- Answer each of the.docxAsset Depreciation 2 2 unread replies- 2 2 replies- Answer each of the.docx
Asset Depreciation 2 2 unread replies- 2 2 replies- Answer each of the.docxjames876543264
 
Ashley Wesley is the assistant controller at the Walitin Construction.docx
Ashley Wesley is the assistant controller at the Walitin Construction.docxAshley Wesley is the assistant controller at the Walitin Construction.docx
Ashley Wesley is the assistant controller at the Walitin Construction.docxjames876543264
 
Assembly language --- Area of a Polygon program Write a program to fin.docx
Assembly language --- Area of a Polygon program Write a program to fin.docxAssembly language --- Area of a Polygon program Write a program to fin.docx
Assembly language --- Area of a Polygon program Write a program to fin.docxjames876543264
 
As a transportation planner-engineer- would you implement a bus servic.docx
As a transportation planner-engineer- would you implement a bus servic.docxAs a transportation planner-engineer- would you implement a bus servic.docx
As a transportation planner-engineer- would you implement a bus servic.docxjames876543264
 
explain why glass electrode is a good example of an ion selective elec.docx
explain why glass electrode is a good example of an ion selective elec.docxexplain why glass electrode is a good example of an ion selective elec.docx
explain why glass electrode is a good example of an ion selective elec.docxjames876543264
 
explain why galvanize steel does not rust Chlorine is added to swimmin.docx
explain why galvanize steel does not rust Chlorine is added to swimmin.docxexplain why galvanize steel does not rust Chlorine is added to swimmin.docx
explain why galvanize steel does not rust Chlorine is added to swimmin.docxjames876543264
 
Explain why in the DPCM structure- the input to the predictor P is the.docx
Explain why in the DPCM structure- the input to the predictor P is the.docxExplain why in the DPCM structure- the input to the predictor P is the.docx
Explain why in the DPCM structure- the input to the predictor P is the.docxjames876543264
 
explain Westminster system- explain Westminster system- explain We.docx
explain Westminster system-    explain Westminster system-  explain We.docxexplain Westminster system-    explain Westminster system-  explain We.docx
explain Westminster system- explain Westminster system- explain We.docxjames876543264
 
Explain what anSolutionAn intervention is a deliberate process by whic.docx
Explain what anSolutionAn intervention is a deliberate process by whic.docxExplain what anSolutionAn intervention is a deliberate process by whic.docx
Explain what anSolutionAn intervention is a deliberate process by whic.docxjames876543264
 
Explain what is meant by the statement that a preferred stock is a hyb.docx
Explain what is meant by the statement that a preferred stock is a hyb.docxExplain what is meant by the statement that a preferred stock is a hyb.docx
Explain what is meant by the statement that a preferred stock is a hyb.docxjames876543264
 
Explain the weaknesses of the OOA-OOD focusing only on Use-cases and C.docx
Explain the weaknesses of the OOA-OOD focusing only on Use-cases and C.docxExplain the weaknesses of the OOA-OOD focusing only on Use-cases and C.docx
Explain the weaknesses of the OOA-OOD focusing only on Use-cases and C.docxjames876543264
 
Explain two Principle of locality used in Memory Hierarchy-SolutionHie.docx
Explain two Principle of locality used in Memory Hierarchy-SolutionHie.docxExplain two Principle of locality used in Memory Hierarchy-SolutionHie.docx
Explain two Principle of locality used in Memory Hierarchy-SolutionHie.docxjames876543264
 
Explain the use of directives in configuration files- Provide an examp.docx
Explain the use of directives in configuration files- Provide an examp.docxExplain the use of directives in configuration files- Provide an examp.docx
Explain the use of directives in configuration files- Provide an examp.docxjames876543264
 
Explain the steps needed to configure RIPng and explain the advantages.docx
Explain the steps needed to configure RIPng and explain the advantages.docxExplain the steps needed to configure RIPng and explain the advantages.docx
Explain the steps needed to configure RIPng and explain the advantages.docxjames876543264
 
Explain the importance of using the typedef keyword then write a C ++.docx
Explain the importance of using the typedef keyword then write a C ++.docxExplain the importance of using the typedef keyword then write a C ++.docx
Explain the importance of using the typedef keyword then write a C ++.docxjames876543264
 

More from james876543264 (20)

Astronomy 107- 1- Why does helium fusion require a higher temperature.docx
Astronomy 107- 1- Why does helium fusion require a higher temperature.docxAstronomy 107- 1- Why does helium fusion require a higher temperature.docx
Astronomy 107- 1- Why does helium fusion require a higher temperature.docx
 
Astronomers have found dark matter in a variety of environments- Name.docx
Astronomers have found dark matter in a variety of environments- Name.docxAstronomers have found dark matter in a variety of environments- Name.docx
Astronomers have found dark matter in a variety of environments- Name.docx
 
Assume that LO and HI have already been assigned as constants with LO.docx
Assume that LO and HI have already been assigned as constants with LO.docxAssume that LO and HI have already been assigned as constants with LO.docx
Assume that LO and HI have already been assigned as constants with LO.docx
 
AS1- Four Condition of Deadloc- show that the four conditions of deadl.docx
AS1- Four Condition of Deadloc- show that the four conditions of deadl.docxAS1- Four Condition of Deadloc- show that the four conditions of deadl.docx
AS1- Four Condition of Deadloc- show that the four conditions of deadl.docx
 
As we know- total ownership is not a requirement for consolidation- A.docx
As we know- total ownership is not a requirement for consolidation- A.docxAs we know- total ownership is not a requirement for consolidation- A.docx
As we know- total ownership is not a requirement for consolidation- A.docx
 
Asset Depreciation 2 2 unread replies- 2 2 replies- Answer each of the.docx
Asset Depreciation 2 2 unread replies- 2 2 replies- Answer each of the.docxAsset Depreciation 2 2 unread replies- 2 2 replies- Answer each of the.docx
Asset Depreciation 2 2 unread replies- 2 2 replies- Answer each of the.docx
 
Ashley Wesley is the assistant controller at the Walitin Construction.docx
Ashley Wesley is the assistant controller at the Walitin Construction.docxAshley Wesley is the assistant controller at the Walitin Construction.docx
Ashley Wesley is the assistant controller at the Walitin Construction.docx
 
Assembly language --- Area of a Polygon program Write a program to fin.docx
Assembly language --- Area of a Polygon program Write a program to fin.docxAssembly language --- Area of a Polygon program Write a program to fin.docx
Assembly language --- Area of a Polygon program Write a program to fin.docx
 
As a transportation planner-engineer- would you implement a bus servic.docx
As a transportation planner-engineer- would you implement a bus servic.docxAs a transportation planner-engineer- would you implement a bus servic.docx
As a transportation planner-engineer- would you implement a bus servic.docx
 
explain why glass electrode is a good example of an ion selective elec.docx
explain why glass electrode is a good example of an ion selective elec.docxexplain why glass electrode is a good example of an ion selective elec.docx
explain why glass electrode is a good example of an ion selective elec.docx
 
explain why galvanize steel does not rust Chlorine is added to swimmin.docx
explain why galvanize steel does not rust Chlorine is added to swimmin.docxexplain why galvanize steel does not rust Chlorine is added to swimmin.docx
explain why galvanize steel does not rust Chlorine is added to swimmin.docx
 
Explain why in the DPCM structure- the input to the predictor P is the.docx
Explain why in the DPCM structure- the input to the predictor P is the.docxExplain why in the DPCM structure- the input to the predictor P is the.docx
Explain why in the DPCM structure- the input to the predictor P is the.docx
 
explain Westminster system- explain Westminster system- explain We.docx
explain Westminster system-    explain Westminster system-  explain We.docxexplain Westminster system-    explain Westminster system-  explain We.docx
explain Westminster system- explain Westminster system- explain We.docx
 
Explain what anSolutionAn intervention is a deliberate process by whic.docx
Explain what anSolutionAn intervention is a deliberate process by whic.docxExplain what anSolutionAn intervention is a deliberate process by whic.docx
Explain what anSolutionAn intervention is a deliberate process by whic.docx
 
Explain what is meant by the statement that a preferred stock is a hyb.docx
Explain what is meant by the statement that a preferred stock is a hyb.docxExplain what is meant by the statement that a preferred stock is a hyb.docx
Explain what is meant by the statement that a preferred stock is a hyb.docx
 
Explain the weaknesses of the OOA-OOD focusing only on Use-cases and C.docx
Explain the weaknesses of the OOA-OOD focusing only on Use-cases and C.docxExplain the weaknesses of the OOA-OOD focusing only on Use-cases and C.docx
Explain the weaknesses of the OOA-OOD focusing only on Use-cases and C.docx
 
Explain two Principle of locality used in Memory Hierarchy-SolutionHie.docx
Explain two Principle of locality used in Memory Hierarchy-SolutionHie.docxExplain two Principle of locality used in Memory Hierarchy-SolutionHie.docx
Explain two Principle of locality used in Memory Hierarchy-SolutionHie.docx
 
Explain the use of directives in configuration files- Provide an examp.docx
Explain the use of directives in configuration files- Provide an examp.docxExplain the use of directives in configuration files- Provide an examp.docx
Explain the use of directives in configuration files- Provide an examp.docx
 
Explain the steps needed to configure RIPng and explain the advantages.docx
Explain the steps needed to configure RIPng and explain the advantages.docxExplain the steps needed to configure RIPng and explain the advantages.docx
Explain the steps needed to configure RIPng and explain the advantages.docx
 
Explain the importance of using the typedef keyword then write a C ++.docx
Explain the importance of using the typedef keyword then write a C ++.docxExplain the importance of using the typedef keyword then write a C ++.docx
Explain the importance of using the typedef keyword then write a C ++.docx
 

Recently uploaded

Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentInMediaRes1
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17Celine George
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementmkooblal
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfadityarao40181
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Celine George
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,Virag Sontakke
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxRaymartEstabillo3
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfUjwalaBharambe
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for BeginnersSabitha Banu
 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxAvyJaneVismanos
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersSabitha Banu
 

Recently uploaded (20)

Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media Component
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of management
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdf
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for Beginners
 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptx
 
ESSENTIAL of (CS/IT/IS) class 06 (database)
ESSENTIAL of (CS/IT/IS) class 06 (database)ESSENTIAL of (CS/IT/IS) class 06 (database)
ESSENTIAL of (CS/IT/IS) class 06 (database)
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginners
 

Explain the motivation behind using a header file for a C program-Solu.docx

  • 1. Explain the motivation behind using a header file for a C program. Solution Motivation behind using header file in c Programming: Header files contain definitions of functions and variables which can be included into any c program by using #include. Compilation speed up and optimization :During compilation of some parts of the code it may be sufficient to load API interfaces from header files to check correctness of the code used while defining them. -2. The motivation for the introduction of header files is type safety. C allows function calls without forward declaration. Logically speaking using functions without forward declaration is as harmful as using Macros as compilers has no proper mechanism to validate the type of the arguments with the parameters. So chances of unresolved linkage errors and runtime failure is more prominent. 3. Header files are more like data abstraction, you just see the important components and you don't need to know the background process. 4. To reduce overhead of RAM....the functions or classes defined in these header files are already compiled so they can be directly used . 5.Including a header allows your code to call functions or methods which are written elsewhere and which may or may not be a part of your software project/build, but which can be found by the 'linker' when you are building the software. 6. Header files are mainly used to declare and include the signatures (i.e. function name, return value and arguments) of your functions in other files. The compiler needs to know these signatures when compiling and linking your files together.