C Sharpinclude

C #include

  • #include <filename>
  • #include "filename"

The #include directive instructs the compiler to search for the location where system header files are stored. In UNIX systems, this is typically the \usr\include directory.

The #include "filename" directive instructs the compiler to search in the present working directory for the specified file.

#include directive example

Let's explore a basic illustration of the #include directive. Within this code, we include the stdio.h file to access the printf function, which is declared within that specific file.

Example

Example

#include<stdio.h>

 int main(){  

   printf("Hello C");    

   return 0;

 }

Output:

Output

Hello C

#include notes:

Note 1: Comments are not acknowledged within the #include directive. Therefore, when using #include <a//b>, the text a//b is interpreted as the filename.

In the #include directive, the backslash is interpreted as regular text rather than an escape sequence. Therefore, when using #include <a\nb>, "a\nb" is recognized as part of the filename.

Note 3: It is important to remember that you are only allowed to include comments after the filename, as any other content will result in an error.

Input Required

This code uses input(). Please provide values below: