Comment in header file name?
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; } |
chevron_right
filter_none
Output:
This will compile
#include <stdio.h/*comment*/> int main() { printf("This will not compile"); return 0; } |
chevron_right
filter_none
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; } |
chevron_right
filter_none
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
Recommended Posts:
- How to write your own header file in C?
- time.h header file in C with Examples
- Print "Hello World" in C/C++ without using any header file
- Difference between Header file and Library
- C program to copy contents of one file to another file
- numeric header in C++ STL | Set 1 (accumulate() and partial_sum())
- What’s difference between header files "stdio.h" and "stdlib.h" ?
- numeric header in C++ STL | Set 2 (adjacent_difference(), inner_product() and iota())
- Namespace in C++ | Set 3 (Accessing, creating header, nesting and aliasing)
- What is data type of FILE in C ?
- C | File Handling | Question 4
- C | File Handling | Question 3
- C | File Handling | Question 2
- C | File Handling | Question 1
- C program to delete a file



