Click here to Skip to main content
15,889,651 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: calling of function ? Pin
CPallini4-Aug-14 20:32
mveCPallini4-Aug-14 20:32 
GeneralRe: calling of function ? Pin
mybm14-Aug-14 20:40
mybm14-Aug-14 20:40 
GeneralRe: calling of function ? Pin
CPallini4-Aug-14 20:49
mveCPallini4-Aug-14 20:49 
GeneralRe: calling of function ? Pin
mybm14-Aug-14 20:57
mybm14-Aug-14 20:57 
GeneralRe: calling of function ? Pin
CPallini4-Aug-14 21:20
mveCPallini4-Aug-14 21:20 
GeneralRe: calling of function ? Pin
mybm14-Aug-14 20:59
mybm14-Aug-14 20:59 
GeneralRe: calling of function ? Pin
CPallini4-Aug-14 21:23
mveCPallini4-Aug-14 21:23 
GeneralRe: calling of function ? Pin
Stefan_Lang5-Aug-14 22:37
Stefan_Lang5-Aug-14 22:37 
It is almost always necessary, and there is no reason not to use header files. Therefore you should never include a .c file.

It all comes down to the question where the actual implementation of the function can be found within the final executable program. The compiler will read your .c files one by one and generate the machine code for all functions implemented therein. All include statements will be resolved before the compiler even sees those files, therefore including another .c file is equivalent to copying the entire code of that .c file! This may result in multiple copies of the same function, and, as a result, the linker may be unable to generate a program.

Technically you can avoid these issues without the help of header files: all you need are declarations of the data types and functions declared somewhere, that you need in your current .c file. The header files are used as a means to assemble this information in just one place, rather than copy the declarations to every .c file that needs them. This way you can ensure that all files are properly updated with the relevant information, whenever the data type or function declarations change!
GOTOs are a bit like wire coat hangers: they tend to breed in the darkness, such that where there once were few, eventually there are many, and the program's architecture collapses beneath them. (Fran Poretto)

AnswerRe: calling of function ? Pin
Satya Chamakuri13-Aug-14 20:34
Satya Chamakuri13-Aug-14 20:34 
GeneralRe: calling of function ? Pin
mybm119-Aug-14 18:13
mybm119-Aug-14 18:13 
QuestionWhich IDE is good for programming in C Pin
SHUVO BISWAS2-Aug-14 21:40
SHUVO BISWAS2-Aug-14 21:40 
AnswerRe: Which IDE is good for programming in C Pin
CPallini3-Aug-14 0:14
mveCPallini3-Aug-14 0:14 
AnswerRe: Which IDE is good for programming in C Pin
«_Superman_»3-Aug-14 3:31
professional«_Superman_»3-Aug-14 3:31 
Questionhow do i make another main.c file where i can call this program and run according to it..? Pin
mybm11-Aug-14 20:31
mybm11-Aug-14 20:31 
AnswerRe: how do i make another main.c file where i can call this program and run according to it..? Pin
Richard MacCutchan1-Aug-14 21:01
mveRichard MacCutchan1-Aug-14 21:01 
GeneralRe: how do i make another main.c file where i can call this program and run according to it..? Pin
mybm11-Aug-14 21:09
mybm11-Aug-14 21:09 
GeneralRe: how do i make another main.c file where i can call this program and run according to it..? Pin
Richard MacCutchan1-Aug-14 21:45
mveRichard MacCutchan1-Aug-14 21:45 
GeneralRe: how do i make another main.c file where i can call this program and run according to it..? Pin
mybm11-Aug-14 23:34
mybm11-Aug-14 23:34 
GeneralRe: how do i make another main.c file where i can call this program and run according to it..? Pin
Richard MacCutchan2-Aug-14 0:41
mveRichard MacCutchan2-Aug-14 0:41 
GeneralRe: how do i make another main.c file where i can call this program and run according to it..? Pin
mybm12-Aug-14 2:06
mybm12-Aug-14 2:06 
GeneralRe: how do i make another main.c file where i can call this program and run according to it..? Pin
Richard MacCutchan2-Aug-14 2:49
mveRichard MacCutchan2-Aug-14 2:49 
GeneralRe: how do i make another main.c file where i can call this program and run according to it..? Pin
CPallini2-Aug-14 2:59
mveCPallini2-Aug-14 2:59 
GeneralRe: how do i make another main.c file where i can call this program and run according to it..? Pin
Richard MacCutchan2-Aug-14 3:05
mveRichard MacCutchan2-Aug-14 3:05 
AnswerRe: Put the other main in a namespace Pin
Software_Developer2-Aug-14 7:10
Software_Developer2-Aug-14 7:10 
GeneralRe: Put the other main in a namespace Pin
CPallini3-Aug-14 0:20
mveCPallini3-Aug-14 0:20 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.