Computing.Net > Forums > Programming > organise separate c files

organise separate c files

Reply to Message Icon

Original Message
Name: Cameron75
Date: December 5, 2005 at 19:50:45 Pacific
Subject: organise separate c files
OS: unix
CPU/Ram: enough
Comment:

Hi everyone

I am writing a fairly large c program which is in its early stages. It is merely a proof of concept thing, not for sale or anything like that....I am an inexperienced programmer.
While it is small I would like to know how I should organise it.

I have a number of *.c files. For each *.c file I have a *.h file.
In the *.h files I list relevant definitions and function prototypes.

I then include the relevant *.h files into whichever *.c files need the data they contain.

I do not include any *.h files in other *.h files...only within *.c files.

I have run into a problem where one *.h file references another *.h file that references the first one.
I can't work out how to resolve it. I want to keep the relevant functions and definitions in their respective *.c files.

How can I fix that?

So basically, am I organising the files correctly?
(I have tried looking at other code but this wasn't helpful as the programs didn't resemble my program's structure)

How do YOU go about using separate files, and what do you include (*.c's? *.h's?) and where?

Thanks very much!


Report Offensive Message For Removal








Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: organise separate c files

Comments:

 


  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 
Data Recovery Software




Have you ever used OpenOffice?

Yes, as my main suite.
Yes, occationally.
Yes, but only once.
No, never.


View Results

Poll Finishes In 5 Days.
Discuss in The Lounge