SlideShare une entreprise Scribd logo
1  sur  12
HEADER FILES IN C
Presented by: Prajjawal Rao Chintal
WHAT IS A HEADER FILE
Header file included at the top of any
C program.
Syntax: #include <file>
All the header file have a '.h' an
extension that contains C function
declaration
Header files are imported into C
program with the help of pre-
processor #include statement
VARIOUS SYSTEM HEADER FILES
name discription
<stdio.h> Input/Output Functions
<conio.h> console input/output
<math.h> Mathematics Functions
<time.h> Date and Time Functions
<string.h> String Functions
<stdlib.h> General Utility Functions
<complex.h> A set of function for manipulating complex
numbers
<ctype.h> Character handling functions
<assert.h> Diagnostics Functions
 The C programming language provides many standard
library functions for file input and output.
<stdio.h> functions
function discription
Printf() This function is used to print the
character, string, float, integer, octal
and hexadecimal values onto the output
screen
Scanf() This function is used to read a character,
string, numeric data from keyboard.
Fopen() Opens a file
Fclose() Close an opened file
Gets() It reads line from keyboard
 conio.h header used in C programming contains
functions for console input/output
<conio.h> functions
function discription
Clrscr() This function is used to clear the
output screen.
Getch() It reads character from keyboard
Getche() It reads character from keyboard
and echoes to o/p screen
Textcolor() This function is used to change the
text color
Textbackground() This function is used to change text
background
 Example of printf() ,scanf() ,getch() and clrscr ()
functions.
#include <stdio.h>
#include <conio.h>
int main()
{
int num1, num2, sum;
clrscr();
printf("Enter any two numbers : n");
scanf("%d%d", &num1, &num2);
sum = num1 + num2;
printf("Sum = %d",sum);
getch();
return 0;
}
 math.h header file supports all the mathematical
related functions in C language.
<math.h> functions
Function Discription
Pow() This is used to find the power of the given number.
Sqrt() This function is used to find square root of the
argument passed to this function.
Log() This function is used to calculates natural logarithm.
Exp() This function is used to calculate the exponential “e”
to the xth power.
Log10() This function is used to calculates base 10 logarithm.
Floor() This function returns the nearest integer which is less
than or equal to the argument passed to this function.
 Example of math.h
#include <stdio.h>
#include <math.h>
int main ()
{
printf("Value 8.0 ^ 3 = %lfn", pow(8.0, 3));
printf("Value 3.05 ^ 1.98 = %lf", pow(3.05, 1.98));
return(0);
}
 Time functions in C are used to interact with system
time routine and formatted time outputs are
displayed
.
<time.h> functions
function discription
Getdate() This function is used to get the CPU time
Setdate() This function used to modify the system
date
Clock() This function is used to get current
system time
Time() This function is used to get current
system time as structure
 Example program for<time.h>
#include<stdio.h>
#include<time.h>
#include<dos.h>
int main()
{
struct date dt;
getdate(&dt);
printf("Operating system's current date is %d-%d-
%dn",dt.da_day,dt.da_mon,dt.da_year);
return 0;
}
 , C supports a large number of string handling
functions in the standard library "string.h".
<string.h> functions
function discription
Strlen() Calculates the length of string
Strcpy() Copies a string to another string
Strcmp() Concatenates(joins) two strings
Strcat() Compares two string
Strlwr() Converts string to lowercase
Strupr() Converts string to uppercase
 Example of strncat:
#include <stdio.h>
#include <string.h>
int main()
{
char s1[10] = "Hello";
char s2[10] = "World";
strncat(s1,s2, 3);
printf("Concatenation using strncat: %s", s1);
return 0;
}

Contenu connexe

Tendances

Files in c++ ppt
Files in c++ pptFiles in c++ ppt
Files in c++ ppt
Kumar
 

Tendances (20)

Presentation on Function in C Programming
Presentation on Function in C ProgrammingPresentation on Function in C Programming
Presentation on Function in C Programming
 
C language unit-1
C language unit-1C language unit-1
C language unit-1
 
Function in c
Function in cFunction in c
Function in c
 
Operators in C++
Operators in C++Operators in C++
Operators in C++
 
Constants in C Programming
Constants in C ProgrammingConstants in C Programming
Constants in C Programming
 
User Defined Functions
User Defined FunctionsUser Defined Functions
User Defined Functions
 
Function in C program
Function in C programFunction in C program
Function in C program
 
Operators in c programming
Operators in c programmingOperators in c programming
Operators in c programming
 
C++ classes tutorials
C++ classes tutorialsC++ classes tutorials
C++ classes tutorials
 
RECURSION IN C
RECURSION IN C RECURSION IN C
RECURSION IN C
 
C functions
C functionsC functions
C functions
 
Files in c++ ppt
Files in c++ pptFiles in c++ ppt
Files in c++ ppt
 
Functions in c language
Functions in c language Functions in c language
Functions in c language
 
File handling in c
File handling in cFile handling in c
File handling in c
 
Operators in C Programming
Operators in C ProgrammingOperators in C Programming
Operators in C Programming
 
Header files of c++ unit 3 -topic 3
Header files of c++ unit 3 -topic 3Header files of c++ unit 3 -topic 3
Header files of c++ unit 3 -topic 3
 
Basics of C programming
Basics of C programmingBasics of C programming
Basics of C programming
 
Preprocessor directives in c language
Preprocessor directives in c languagePreprocessor directives in c language
Preprocessor directives in c language
 
Python unit 3 and Unit 4
Python unit 3 and Unit 4Python unit 3 and Unit 4
Python unit 3 and Unit 4
 
Array and string
Array and stringArray and string
Array and string
 

Similaire à Header files in c

Chapter 10 Library Function
Chapter 10 Library FunctionChapter 10 Library Function
Chapter 10 Library Function
Deepak Singh
 

Similaire à Header files in c (20)

Built in function
Built in functionBuilt in function
Built in function
 
Function in c program
Function in c programFunction in c program
Function in c program
 
Chapter 10 Library Function
Chapter 10 Library FunctionChapter 10 Library Function
Chapter 10 Library Function
 
Header files of c++ unit 3 -topic 3
Header files of c++ unit 3 -topic 3Header files of c++ unit 3 -topic 3
Header files of c++ unit 3 -topic 3
 
Unit2 input output
Unit2 input outputUnit2 input output
Unit2 input output
 
Functions
FunctionsFunctions
Functions
 
Programming Fundamentals Functions in C and types
Programming Fundamentals  Functions in C  and typesProgramming Fundamentals  Functions in C  and types
Programming Fundamentals Functions in C and types
 
Python Functions Tutorial | Working With Functions In Python | Python Trainin...
Python Functions Tutorial | Working With Functions In Python | Python Trainin...Python Functions Tutorial | Working With Functions In Python | Python Trainin...
Python Functions Tutorial | Working With Functions In Python | Python Trainin...
 
unit_2 (1).pptx
unit_2 (1).pptxunit_2 (1).pptx
unit_2 (1).pptx
 
UNIT-II CP DOC.docx
UNIT-II CP DOC.docxUNIT-II CP DOC.docx
UNIT-II CP DOC.docx
 
Functions in C++
Functions in C++Functions in C++
Functions in C++
 
String Manipulation Function and Header File Functions
String Manipulation Function and Header File FunctionsString Manipulation Function and Header File Functions
String Manipulation Function and Header File Functions
 
Input and Output In C Language
Input and Output In C LanguageInput and Output In C Language
Input and Output In C Language
 
Basic of C Programming | 2022 Updated | By Shamsul H. Ansari
Basic of C Programming | 2022 Updated | By Shamsul H. AnsariBasic of C Programming | 2022 Updated | By Shamsul H. Ansari
Basic of C Programming | 2022 Updated | By Shamsul H. Ansari
 
C Language Lecture 16
C Language Lecture 16C Language Lecture 16
C Language Lecture 16
 
C function
C functionC function
C function
 
Advanced Web Technology ass.pdf
Advanced Web Technology ass.pdfAdvanced Web Technology ass.pdf
Advanced Web Technology ass.pdf
 
Function
FunctionFunction
Function
 
unit_2.pptx
unit_2.pptxunit_2.pptx
unit_2.pptx
 
Python Lecture 4
Python Lecture 4Python Lecture 4
Python Lecture 4
 

Dernier

The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
heathfieldcps1
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
negromaestrong
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
 

Dernier (20)

2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Role Of Transgenic Animal In Target Validation-1.pptx
Role Of Transgenic Animal In Target Validation-1.pptxRole Of Transgenic Animal In Target Validation-1.pptx
Role Of Transgenic Animal In Target Validation-1.pptx
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docx
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 

Header files in c

  • 1. HEADER FILES IN C Presented by: Prajjawal Rao Chintal
  • 2. WHAT IS A HEADER FILE Header file included at the top of any C program. Syntax: #include <file> All the header file have a '.h' an extension that contains C function declaration Header files are imported into C program with the help of pre- processor #include statement
  • 3. VARIOUS SYSTEM HEADER FILES name discription <stdio.h> Input/Output Functions <conio.h> console input/output <math.h> Mathematics Functions <time.h> Date and Time Functions <string.h> String Functions <stdlib.h> General Utility Functions <complex.h> A set of function for manipulating complex numbers <ctype.h> Character handling functions <assert.h> Diagnostics Functions
  • 4.  The C programming language provides many standard library functions for file input and output. <stdio.h> functions function discription Printf() This function is used to print the character, string, float, integer, octal and hexadecimal values onto the output screen Scanf() This function is used to read a character, string, numeric data from keyboard. Fopen() Opens a file Fclose() Close an opened file Gets() It reads line from keyboard
  • 5.  conio.h header used in C programming contains functions for console input/output <conio.h> functions function discription Clrscr() This function is used to clear the output screen. Getch() It reads character from keyboard Getche() It reads character from keyboard and echoes to o/p screen Textcolor() This function is used to change the text color Textbackground() This function is used to change text background
  • 6.  Example of printf() ,scanf() ,getch() and clrscr () functions. #include <stdio.h> #include <conio.h> int main() { int num1, num2, sum; clrscr(); printf("Enter any two numbers : n"); scanf("%d%d", &num1, &num2); sum = num1 + num2; printf("Sum = %d",sum); getch(); return 0; }
  • 7.  math.h header file supports all the mathematical related functions in C language. <math.h> functions Function Discription Pow() This is used to find the power of the given number. Sqrt() This function is used to find square root of the argument passed to this function. Log() This function is used to calculates natural logarithm. Exp() This function is used to calculate the exponential “e” to the xth power. Log10() This function is used to calculates base 10 logarithm. Floor() This function returns the nearest integer which is less than or equal to the argument passed to this function.
  • 8.  Example of math.h #include <stdio.h> #include <math.h> int main () { printf("Value 8.0 ^ 3 = %lfn", pow(8.0, 3)); printf("Value 3.05 ^ 1.98 = %lf", pow(3.05, 1.98)); return(0); }
  • 9.  Time functions in C are used to interact with system time routine and formatted time outputs are displayed . <time.h> functions function discription Getdate() This function is used to get the CPU time Setdate() This function used to modify the system date Clock() This function is used to get current system time Time() This function is used to get current system time as structure
  • 10.  Example program for<time.h> #include<stdio.h> #include<time.h> #include<dos.h> int main() { struct date dt; getdate(&dt); printf("Operating system's current date is %d-%d- %dn",dt.da_day,dt.da_mon,dt.da_year); return 0; }
  • 11.  , C supports a large number of string handling functions in the standard library "string.h". <string.h> functions function discription Strlen() Calculates the length of string Strcpy() Copies a string to another string Strcmp() Concatenates(joins) two strings Strcat() Compares two string Strlwr() Converts string to lowercase Strupr() Converts string to uppercase
  • 12.  Example of strncat: #include <stdio.h> #include <string.h> int main() { char s1[10] = "Hello"; char s2[10] = "World"; strncat(s1,s2, 3); printf("Concatenation using strncat: %s", s1); return 0; }