#include in C
×


#include in C

35

The #include directive in C is used to include header files, allowing access to external functions, variables, and declarations, enhancing code modularity and reusability.

Types of #include in C 

1System Header Files:

Includes standard library header files using angle brackets (<>).

#include


2User-defined Header Files:

Includes custom header files using double quotes ("").

#include "myheader.h"

Example:

#include<stdio.h>  // Including standard I/O header file

int main() {
    printf("Hello, World!\n");  // Using printf function from stdio.h

    return 0;
}

Output:

Hello, World!

In this example:

#include includes the standard I/O library header file, providing access to printf().

#include "myheader.h" includes a user-defined header file, which may contain custom function declarations, variables, or macros.

Both types of #include directives that contribute to organizing and extending the functionality of the C program.



Best WordPress Hosting


Share:


Discount Coupons

Get a .COM for just $6.98

Secure Domain for a Mini Price



Leave a Reply


Comments
    Waiting for your comments