string.h header in the file with the function main

90 views Asked by At

I have a program with several .c and .h files. In one of the .c files I am using the function strcmp(). I am adding in this file the header for string.h

Is the string.h header in the file with the function main also required?

Thanks!

1

There are 1 answers

0
Vlad from Moscow On

If the translation unit containing the function main does not use the function strcmp or any other declaration from the header <string.h> then inclusion of the header in this translation unit is redundant and only confuses readers.