C - Introduction Header file

Introduction

Look at the following line of code:

#include <stdio.h>                      // This is a preprocessor directive

By using the line above we tell the compiler to "include" in your program the contents of the file with the name stdio.h.

This file is called a header file.

The header file defines the functions that are provided by the standard C library.

You can create your own header files with your programs.

Consider the following code

#include <stdio.h>    // This is a preprocessor directive

int main(void)                              
{                                           
  printf("hi from book2s.com!");     
  return 0;                          
}    

You're using the printf() function from the standard library, you have to include the stdio.h header file.

stdio.h contains the information that the compiler needs to understand what printf() means.

stdio, is short for standard input/output.

All header files in C have file names with the extension .h