JUNG Jules
JUNG Jules

Reputation: 9

Including header file in source file of the same name

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);
}

Upvotes: 0

Views: 94

Answers (0)

Related Questions