#include Header files in C with definition too

53 views Asked by At

I'm like a 100% sure that this is a basic thing, and therefore I'm sorry if it has been answered.

I've seen many code samples and code bases where people include header files like this:

#include "util.h"

int main(void){
    int result = function1(); // something that was defined in util.h but implemented elsewhere
    return 0;
}
 

...while the content of the given header file is just:

#pragma once

int function1();
int function2();
float function3();

And probably there is a util.c somewhere that has:

#include "util.h"

int function1(){
    ...
}
int function2(){
    ...
}
float function3(){
    ...
}

I have experience with the language.
I've used it in 1-2 larger projects (irc client).
I've used make files too, even though they were more like "script files".
But this header file thing... Can someone explain me this?

0

There are 0 answers