Skip to content
Related Articles

Related Articles

Improve Article

Comment in header file name?

  • Difficulty Level : Easy
  • Last Updated : 08 May, 2017
Geek Week

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

Take a step-up from those “Hello World” programs. Learn to implement data structures like Heap, Stacks, Linked List and many more! Check out our Data Structures in C course to start learning today.



My Personal Notes arrow_drop_up
Recommended Articles
Page :