Skip to content
Related Articles

Related Articles

Comment in header file name?
  • Difficulty Level : Easy
  • Last Updated : 08 May, 2017

What happens if there is a comment in header file name?
Parsing of `#include’ is slightly special because comments are not recognized within the ”. Thus, in `#include ‘ the `/*’ does not start a comment and the directive specifies inclusion of a system header file named `x/*y’. Of course, a header file with such a name is unlikely to exist on Unix, where shell wildcard features would make it hard to manipulate.

Below are some examples.




#include <stdio.h>
int main()
{
  printf("This will compile");
  return 0;
}

Output:

This will compile




#include <stdio.h/*comment*/>
int main()
{
  printf("This will not compile");
  return 0;
}

Output:

Error: stdio.h/*comment*/: No such file or directory




#include <std/*comment*/io.h>
int main()
{
  printf("This will not compile either");
  return 0;
}

Output:

Error: std/*comment*/io.h: No such file or directory

This article is contributed by Pankaj Boola. Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above

Want to learn from the best curated videos and practice problems, check out the C Foundation Course for Basic to Advanced C.



My Personal Notes arrow_drop_up
Recommended Articles
Page :