Including header file in source file of the same name

79 views Asked by At

Is it required to include the header file in the corresponding source file if they both have the same name ?

Here is an example of what I mean :

main.c

#include <stdlib.h>
#include "display.h"

int main(void)
{
    display("Hello, world!");
    return EXIT_SUCCESS;
}

display.h

#ifndef DISPLAY_H
#define DISPLAY_H

void display(char* message);

#endif

display.c

#include "display.h" // <<< Is this line required
#include <stdio.h>

void display(char* message)
{
    printf("%s\n", message);
}
0

There are 0 answers