Standard header files in C

C++ProgrammingServer Side Programming

In C language, header files contain the set of predefined standard library functions. The “#include” preprocessing directive is used to include the header files with “.h” extension in the program.

Here is the table that displays some of the header files in C language,

Sr.No.Header Files & Description
1stdio.h
Input/Output functions
2conio.h
Console Input/Output functions
3stdlib.h
General utility functions
4math.h
Mathematics functions
5string.h
String functions
6ctype.h
Character handling functions
7time.h
Date and time functions
8float.h
Limits of float types
9limits.h
Size of basic types
10wctype.h
Functions to determine the type contained in wide character data.

Here is an example of header files in C language,

Example

 Live Demo

#include <stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>

int main() {
   char s1[20] = "53875";
   char s2[10] = "Hello";
   char s3[10] = "World";
   int res;

   res = pow(8, 4);
   printf("Using math.h, The value is : %d\n", res);

   long int a = atol(s1);
   printf("Using stdlib.h, the string to long int : %d\n", a);
   
   strcpy(s2, s3);
   printf("Using string.h, the strings s2 and s3 : %s\t%s\n", s2, s3 );

   return 0;
}

Output

Here is the output −

Using math.h, The value is : 4096
Using stdlib.h, the string to long int : 53875
Using string.h, the strings s2 and s3 : World World
raja
Published on 23-Oct-2018 16:03:16
Advertisements