Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7796323
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T23:20:26+00:00 2026-06-01T23:20:26+00:00

Possible Duplicate: What are the point of header files in C? I am working

  • 0

Possible Duplicate:
What are the point of header files in C?

I am working on a unix project. After searching a lot , many suggest use of header files as they are used to write code that need to be shared between several source files.

It is best to centralise the definitions in one file – Header File.

Now I got two doubts:
1) What is the significance of using header file over simply .c files.
As from this answer I get that header files are not compiled to object files. Then What happen(actually how gcc treats them)? What is the benefit? What the answer I shared want to point?

2) What are the rules or convention to write a header files. I only know this:

Header files usually ONLY contain definitions of data types,
function prototypes and C preprocessor commands.

Can we write only this i.e is this is a rule or convention?

Can anyone tell me any source to learn how to write header files.

I am able to find only this –Writing Larger Programs-which does not contain much. Or any other tip or style for writing better and optimized header files.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T23:20:27+00:00Added an answer on June 1, 2026 at 11:20 pm

    1) header files allow you to pass information between .c files, e.g., definitions, or the existence of functions in other .c files, which allows you to keep code that logically belongs together in one place; the #include directive treats the named file as if it were part of the file in which it is named, which allows you to spare a lot of redundant typing

    2) the convention is to pass #define’s, enum’s, and function declarations into .h files, with actual functional code (besides the occasional static inline function) in .c files

    The rule is: whatever the compiler will eat without dying is more or less allowed, as long as it results in a functional program. The conventions exist more or less to help you keep your projects in an understandable, maintainable state.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Floating point inaccuracy examples I am working with parsing xlsx files and
Possible Duplicate: SQL Server 2008 Spatial: find a point in polygon I am working
Possible Duplicate: Extended Precision Floating Point Library C/C++ I am working with fractals at
Possible Duplicate: Round a double to 2 significant figures after decimal point The code
Possible Duplicate: Floating point issue in C #include<stdio.h> main() { int a,b; float f;
Possible Duplicate: C compiler bug (floating point arithmetic)? I've got two doubles which I
Possible Duplicate: How is floating point stored? When does it matter? Using the built-in
Possible Duplicate: Calculate age in JavaScript In some point of my JS code I
Possible Duplicate: What does the exclamation mark do before the function? What's the point
Possible Duplicate: Floating point inaccuracy examples PHP rounding issue - Is this a bug?

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.