SlideShare a Scribd company logo
1 of 19
C LIBRARIES AND USER DEFINED LIBRARIES
• C Standard library functions or simply C Library functions are inbuilt
functions in C programming.
• The prototype and data definitions of these functions are present in
their respective header files.
• To use these functions we need to include the header file in our
program.
C STANDARD LIBRARY FUNCTIONS
For example,
If you want to use the printf() function, the header file <stdio.h> should be
included.
#include <stdio.h>
int main()
{
printf("Catch me if you can.");
}
If you try to use printf() without including the stdio.h header file, you will
get an error.
• Library functions are built-in functions that are grouped together and
placed in a common location called library.
• Each function here performs a specific operation. We can use this
library functions to get the pre-defined output.
• All C standard library functions are declared by using many header
files. These library functions are created at the time of designing the
compilers.
• We include the header files in our C program by
using #include<filename.h>. Whenever the program is run and
executed, the related files are included in the C program.
HEADER FILE FUNCTIONS
Some of the header file functions are as follows −
•stdio.h − It is a standard i/o header file in which Input/output functions
are declared
•conio.h − This is a console input/output header file.
•string.h − All string related functions are in this header file.
•stdlib.h − This file contains common functions which are used in the C
programs.
•math.h − All functions related to mathematics are in this header file.
•time.h − This file contains time and clock related functions.Built
functions in stdio.h
Sl.N
o
Function & Description
1 printf()
This function is used to print the all char, int, float, string
etc., values onto the output screen.
2 scanf()
This function is used to read data from keyboard.
3 getc()
It reads character from file.
4 gets()
It reads line from keyboard.
5 getchar()
It reads character from keyboard.
6 puts()
It writes line to o/p screen.
7 putchar()
It writes a character to screen.
8 fopen()
All file handling functions are defined in stdio.h
header file.
9 fclose()
Closes an opened file.
10 getw()
Reads an integer from file.
11 putw()
Writes an integer to file.
12 fgetc()
Reads a character from file.
13 putc()
Writes a character to file.
14 fputc()
Writes a character to file.
15 fgets()
Reads string from a file, one line at a time.
16 f puts()
Writes string to a file.
17 feof()
Finds end of file.
18 fgetchar
Reads a character from keyboard.
19 fgetc()
Reads a character from file.
20 fprintf()
Writes formatted data to a file.
21 fscanf()
Reads formatted data from a file.
22 fputchar
Writes a character from keyboard.
23 fseek()
Moves file pointer to given location.
24 SEEK_SET
Moves file pointer at the beginning of the file.
25 SEEK_CUR
Moves file pointer at given location.
26 SEEK_END
Moves file pointer at the end of file.
27 ftell()
Gives current position of file pointer.
28 rewind()
Moves file pointer to the beginning of the file.
29 putc()
Writes a character to file.
30 sprint()
Writes formatted output to string.
31 sscanf()
Reads formatted input from a string.
32 remove()
Deletes a file.
33 flush()
Flushes a file.
USER-DEFINED FUNCTION
• A user-defined function is a function written by the user to write any
program code and execute specific actions.
• These user-defined functions can be modified and execute according
to the requirement of the programmer.
• A programmer can change the user-defined function, but these
functions are not defined in the C header files.
• A user-defined function is made up using the function declaration,
function definition, and the function call.
FUNCTION DEFINITION
The function definition defines the actual body of the function that
perform some specific tasks in a program.
Syntax:
return_type function_name (data_type arg1, data_type arg2, ... )
{
// define the variables
statement to be executed;
return (expr);
}
FUNCTION CALLING
• After defining the function definition, we need to call the defined
function in a program to execute its tasks.
• However, a function can be called multiple times by writing the
function name followed by arguments lists.
function_name(arg1, arg2, ...)
Syntax:
Here, arg1, arg2 are the actual arguments passed to the
function_name.
FUNCTION DECLARATION
• The function declaration defines the function name, return type and
the passed arguments in it.
• A function definition is always defined outside of the main()
function in any C program.
Syntax:
return_type function_name ( data_type arg1, data_type arg2, ..) ;
LIBRARY FUNCTION
• C programming language provides some library functions to perform
some predefined tasks.
• These functions are also called the built-in or predefined function in
the C header files whose meaning cannot change.
• When we use these functions on any program, we call the function
name with appropriate header files because these functions are
defined inside the header files.
• In other words, we did not require to write the complete code to
perform a specific task. For example: printf(), scanf(), getch(), etc.,
are the predefined library functions.

More Related Content

Similar to C-Programming C LIBRARIES AND USER DEFINED LIBRARIES.pptx

Managing input and output operation in c
Managing input and output operation in cManaging input and output operation in c
Managing input and output operation in cyazad dumasia
 
Chapter Functions for grade 12 computer Science
Chapter Functions for grade 12 computer ScienceChapter Functions for grade 12 computer Science
Chapter Functions for grade 12 computer ScienceKrithikaTM
 
Basic information of function in cpu
Basic information of function in cpuBasic information of function in cpu
Basic information of function in cpuDhaval Jalalpara
 
C_and_C++_notes.pdf
C_and_C++_notes.pdfC_and_C++_notes.pdf
C_and_C++_notes.pdfTigabu Yaya
 
VIT351 Software Development VI Unit1
VIT351 Software Development VI Unit1VIT351 Software Development VI Unit1
VIT351 Software Development VI Unit1YOGESH SINGH
 
Chapter 11 Function
Chapter 11 FunctionChapter 11 Function
Chapter 11 FunctionDeepak Singh
 
D-38 vedant ICCPL.pptx
D-38 vedant ICCPL.pptxD-38 vedant ICCPL.pptx
D-38 vedant ICCPL.pptxVedantSahane
 
Functions in C++
Functions in C++Functions in C++
Functions in C++home
 
Lecture 1_Functions in C.pptx
Lecture 1_Functions in C.pptxLecture 1_Functions in C.pptx
Lecture 1_Functions in C.pptxKhurramKhan173
 
Unit 5 quesn b ans5
Unit 5 quesn b ans5Unit 5 quesn b ans5
Unit 5 quesn b ans5Sowri Rajan
 
POLITEKNIK MALAYSIA
POLITEKNIK MALAYSIAPOLITEKNIK MALAYSIA
POLITEKNIK MALAYSIAAiman Hud
 
CS 23001 Computer Science II Data Structures & AbstractionPro.docx
CS 23001 Computer Science II Data Structures & AbstractionPro.docxCS 23001 Computer Science II Data Structures & AbstractionPro.docx
CS 23001 Computer Science II Data Structures & AbstractionPro.docxfaithxdunce63732
 

Similar to C-Programming C LIBRARIES AND USER DEFINED LIBRARIES.pptx (20)

Managing input and output operation in c
Managing input and output operation in cManaging input and output operation in c
Managing input and output operation in c
 
Chapter Functions for grade 12 computer Science
Chapter Functions for grade 12 computer ScienceChapter Functions for grade 12 computer Science
Chapter Functions for grade 12 computer Science
 
Basic information of function in cpu
Basic information of function in cpuBasic information of function in cpu
Basic information of function in cpu
 
C_and_C++_notes.pdf
C_and_C++_notes.pdfC_and_C++_notes.pdf
C_and_C++_notes.pdf
 
Functions in c
Functions in cFunctions in c
Functions in c
 
Lecture 1
Lecture 1Lecture 1
Lecture 1
 
VIT351 Software Development VI Unit1
VIT351 Software Development VI Unit1VIT351 Software Development VI Unit1
VIT351 Software Development VI Unit1
 
Chapter 11 Function
Chapter 11 FunctionChapter 11 Function
Chapter 11 Function
 
D-38 vedant ICCPL.pptx
D-38 vedant ICCPL.pptxD-38 vedant ICCPL.pptx
D-38 vedant ICCPL.pptx
 
Python_Functions_Unit1.pptx
Python_Functions_Unit1.pptxPython_Functions_Unit1.pptx
Python_Functions_Unit1.pptx
 
Functions in C++
Functions in C++Functions in C++
Functions in C++
 
Lecture 1_Functions in C.pptx
Lecture 1_Functions in C.pptxLecture 1_Functions in C.pptx
Lecture 1_Functions in C.pptx
 
Unit 3 (1)
Unit 3 (1)Unit 3 (1)
Unit 3 (1)
 
Unit 5 quesn b ans5
Unit 5 quesn b ans5Unit 5 quesn b ans5
Unit 5 quesn b ans5
 
Functions
Functions Functions
Functions
 
C structure
C structureC structure
C structure
 
FUNCTION CPU
FUNCTION CPUFUNCTION CPU
FUNCTION CPU
 
POLITEKNIK MALAYSIA
POLITEKNIK MALAYSIAPOLITEKNIK MALAYSIA
POLITEKNIK MALAYSIA
 
unit_2 (1).pptx
unit_2 (1).pptxunit_2 (1).pptx
unit_2 (1).pptx
 
CS 23001 Computer Science II Data Structures & AbstractionPro.docx
CS 23001 Computer Science II Data Structures & AbstractionPro.docxCS 23001 Computer Science II Data Structures & AbstractionPro.docx
CS 23001 Computer Science II Data Structures & AbstractionPro.docx
 

More from LECO9

C Programming Intro.ppt
C Programming Intro.pptC Programming Intro.ppt
C Programming Intro.pptLECO9
 
Embedded Systems.pptx
Embedded Systems.pptxEmbedded Systems.pptx
Embedded Systems.pptxLECO9
 
Basic Electronics.pptx
Basic Electronics.pptxBasic Electronics.pptx
Basic Electronics.pptxLECO9
 
Intro to Microcontroller.pptx
Intro to Microcontroller.pptxIntro to Microcontroller.pptx
Intro to Microcontroller.pptxLECO9
 
PIC_Intro.pptx
PIC_Intro.pptxPIC_Intro.pptx
PIC_Intro.pptxLECO9
 
DATATYPES,KEYWORDS,FORMATSPECS[1].pptx
DATATYPES,KEYWORDS,FORMATSPECS[1].pptxDATATYPES,KEYWORDS,FORMATSPECS[1].pptx
DATATYPES,KEYWORDS,FORMATSPECS[1].pptxLECO9
 
STACKS AND QUEUES.pptx
STACKS AND QUEUES.pptxSTACKS AND QUEUES.pptx
STACKS AND QUEUES.pptxLECO9
 
UNIONS IN C.pptx
UNIONS IN C.pptxUNIONS IN C.pptx
UNIONS IN C.pptxLECO9
 
Processes, Threads.pptx
Processes, Threads.pptxProcesses, Threads.pptx
Processes, Threads.pptxLECO9
 
OPERATORS IN C.pptx
OPERATORS IN C.pptxOPERATORS IN C.pptx
OPERATORS IN C.pptxLECO9
 
DATA STRUCTURES AND LINKED LISTS IN C.pptx
DATA STRUCTURES AND LINKED LISTS IN C.pptxDATA STRUCTURES AND LINKED LISTS IN C.pptx
DATA STRUCTURES AND LINKED LISTS IN C.pptxLECO9
 
DESIGN PATTERN.pptx
DESIGN PATTERN.pptxDESIGN PATTERN.pptx
DESIGN PATTERN.pptxLECO9
 
INTER PROCESS COMMUNICATION (IPC).pptx
INTER PROCESS COMMUNICATION (IPC).pptxINTER PROCESS COMMUNICATION (IPC).pptx
INTER PROCESS COMMUNICATION (IPC).pptxLECO9
 
cprogramming Structures.pptx
cprogramming Structures.pptxcprogramming Structures.pptx
cprogramming Structures.pptxLECO9
 
POINTERS.pptx
POINTERS.pptxPOINTERS.pptx
POINTERS.pptxLECO9
 
DYNAMIC MEMORY ALLOCATION.pptx
DYNAMIC MEMORY ALLOCATION.pptxDYNAMIC MEMORY ALLOCATION.pptx
DYNAMIC MEMORY ALLOCATION.pptxLECO9
 
cprogramming strings.pptx
cprogramming strings.pptxcprogramming strings.pptx
cprogramming strings.pptxLECO9
 
C-Programming Control statements.pptx
C-Programming Control statements.pptxC-Programming Control statements.pptx
C-Programming Control statements.pptxLECO9
 
C-Programming Function pointers.pptx
C-Programming  Function pointers.pptxC-Programming  Function pointers.pptx
C-Programming Function pointers.pptxLECO9
 
C-Programming File-handling-C.pptx
C-Programming  File-handling-C.pptxC-Programming  File-handling-C.pptx
C-Programming File-handling-C.pptxLECO9
 

More from LECO9 (20)

C Programming Intro.ppt
C Programming Intro.pptC Programming Intro.ppt
C Programming Intro.ppt
 
Embedded Systems.pptx
Embedded Systems.pptxEmbedded Systems.pptx
Embedded Systems.pptx
 
Basic Electronics.pptx
Basic Electronics.pptxBasic Electronics.pptx
Basic Electronics.pptx
 
Intro to Microcontroller.pptx
Intro to Microcontroller.pptxIntro to Microcontroller.pptx
Intro to Microcontroller.pptx
 
PIC_Intro.pptx
PIC_Intro.pptxPIC_Intro.pptx
PIC_Intro.pptx
 
DATATYPES,KEYWORDS,FORMATSPECS[1].pptx
DATATYPES,KEYWORDS,FORMATSPECS[1].pptxDATATYPES,KEYWORDS,FORMATSPECS[1].pptx
DATATYPES,KEYWORDS,FORMATSPECS[1].pptx
 
STACKS AND QUEUES.pptx
STACKS AND QUEUES.pptxSTACKS AND QUEUES.pptx
STACKS AND QUEUES.pptx
 
UNIONS IN C.pptx
UNIONS IN C.pptxUNIONS IN C.pptx
UNIONS IN C.pptx
 
Processes, Threads.pptx
Processes, Threads.pptxProcesses, Threads.pptx
Processes, Threads.pptx
 
OPERATORS IN C.pptx
OPERATORS IN C.pptxOPERATORS IN C.pptx
OPERATORS IN C.pptx
 
DATA STRUCTURES AND LINKED LISTS IN C.pptx
DATA STRUCTURES AND LINKED LISTS IN C.pptxDATA STRUCTURES AND LINKED LISTS IN C.pptx
DATA STRUCTURES AND LINKED LISTS IN C.pptx
 
DESIGN PATTERN.pptx
DESIGN PATTERN.pptxDESIGN PATTERN.pptx
DESIGN PATTERN.pptx
 
INTER PROCESS COMMUNICATION (IPC).pptx
INTER PROCESS COMMUNICATION (IPC).pptxINTER PROCESS COMMUNICATION (IPC).pptx
INTER PROCESS COMMUNICATION (IPC).pptx
 
cprogramming Structures.pptx
cprogramming Structures.pptxcprogramming Structures.pptx
cprogramming Structures.pptx
 
POINTERS.pptx
POINTERS.pptxPOINTERS.pptx
POINTERS.pptx
 
DYNAMIC MEMORY ALLOCATION.pptx
DYNAMIC MEMORY ALLOCATION.pptxDYNAMIC MEMORY ALLOCATION.pptx
DYNAMIC MEMORY ALLOCATION.pptx
 
cprogramming strings.pptx
cprogramming strings.pptxcprogramming strings.pptx
cprogramming strings.pptx
 
C-Programming Control statements.pptx
C-Programming Control statements.pptxC-Programming Control statements.pptx
C-Programming Control statements.pptx
 
C-Programming Function pointers.pptx
C-Programming  Function pointers.pptxC-Programming  Function pointers.pptx
C-Programming Function pointers.pptx
 
C-Programming File-handling-C.pptx
C-Programming  File-handling-C.pptxC-Programming  File-handling-C.pptx
C-Programming File-handling-C.pptx
 

Recently uploaded

Introduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECHIntroduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECHC Sai Kiran
 
DATA ANALYTICS PPT definition usage example
DATA ANALYTICS PPT definition usage exampleDATA ANALYTICS PPT definition usage example
DATA ANALYTICS PPT definition usage examplePragyanshuParadkar1
 
Arduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.pptArduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.pptSAURABHKUMAR892774
 
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEINFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEroselinkalist12
 
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionSachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionDr.Costas Sachpazis
 
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerAnamika Sarkar
 
Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...VICTOR MAESTRE RAMIREZ
 
Concrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxConcrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxKartikeyaDwivedi3
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSCAESB
 
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfCCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfAsst.prof M.Gokilavani
 
Artificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxArtificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxbritheesh05
 
Introduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptxIntroduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptxk795866
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024Mark Billinghurst
 
Heart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxHeart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxPoojaBan
 
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort serviceGurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort servicejennyeacort
 

Recently uploaded (20)

Design and analysis of solar grass cutter.pdf
Design and analysis of solar grass cutter.pdfDesign and analysis of solar grass cutter.pdf
Design and analysis of solar grass cutter.pdf
 
POWER SYSTEMS-1 Complete notes examples
POWER SYSTEMS-1 Complete notes  examplesPOWER SYSTEMS-1 Complete notes  examples
POWER SYSTEMS-1 Complete notes examples
 
Introduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECHIntroduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECH
 
DATA ANALYTICS PPT definition usage example
DATA ANALYTICS PPT definition usage exampleDATA ANALYTICS PPT definition usage example
DATA ANALYTICS PPT definition usage example
 
Arduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.pptArduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.ppt
 
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEINFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
 
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionSachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
 
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
 
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Serviceyoung call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
 
young call girls in Green Park🔝 9953056974 🔝 escort Service
young call girls in Green Park🔝 9953056974 🔝 escort Serviceyoung call girls in Green Park🔝 9953056974 🔝 escort Service
young call girls in Green Park🔝 9953056974 🔝 escort Service
 
Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...
 
Concrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxConcrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptx
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentation
 
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
 
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfCCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
 
Artificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxArtificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptx
 
Introduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptxIntroduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptx
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024
 
Heart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxHeart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptx
 
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort serviceGurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
 

C-Programming C LIBRARIES AND USER DEFINED LIBRARIES.pptx

  • 1. C LIBRARIES AND USER DEFINED LIBRARIES
  • 2. • C Standard library functions or simply C Library functions are inbuilt functions in C programming. • The prototype and data definitions of these functions are present in their respective header files. • To use these functions we need to include the header file in our program. C STANDARD LIBRARY FUNCTIONS
  • 3. For example, If you want to use the printf() function, the header file <stdio.h> should be included. #include <stdio.h> int main() { printf("Catch me if you can."); } If you try to use printf() without including the stdio.h header file, you will get an error.
  • 4. • Library functions are built-in functions that are grouped together and placed in a common location called library. • Each function here performs a specific operation. We can use this library functions to get the pre-defined output. • All C standard library functions are declared by using many header files. These library functions are created at the time of designing the compilers. • We include the header files in our C program by using #include<filename.h>. Whenever the program is run and executed, the related files are included in the C program.
  • 5. HEADER FILE FUNCTIONS Some of the header file functions are as follows − •stdio.h − It is a standard i/o header file in which Input/output functions are declared •conio.h − This is a console input/output header file. •string.h − All string related functions are in this header file. •stdlib.h − This file contains common functions which are used in the C programs. •math.h − All functions related to mathematics are in this header file. •time.h − This file contains time and clock related functions.Built functions in stdio.h
  • 6. Sl.N o Function & Description 1 printf() This function is used to print the all char, int, float, string etc., values onto the output screen. 2 scanf() This function is used to read data from keyboard. 3 getc() It reads character from file. 4 gets() It reads line from keyboard.
  • 7. 5 getchar() It reads character from keyboard. 6 puts() It writes line to o/p screen. 7 putchar() It writes a character to screen.
  • 8. 8 fopen() All file handling functions are defined in stdio.h header file. 9 fclose() Closes an opened file. 10 getw() Reads an integer from file. 11 putw() Writes an integer to file.
  • 9. 12 fgetc() Reads a character from file. 13 putc() Writes a character to file. 14 fputc() Writes a character to file. 15 fgets() Reads string from a file, one line at a time.
  • 10. 16 f puts() Writes string to a file. 17 feof() Finds end of file. 18 fgetchar Reads a character from keyboard. 19 fgetc() Reads a character from file.
  • 11. 20 fprintf() Writes formatted data to a file. 21 fscanf() Reads formatted data from a file. 22 fputchar Writes a character from keyboard. 23 fseek() Moves file pointer to given location.
  • 12. 24 SEEK_SET Moves file pointer at the beginning of the file. 25 SEEK_CUR Moves file pointer at given location. 26 SEEK_END Moves file pointer at the end of file. 27 ftell() Gives current position of file pointer.
  • 13. 28 rewind() Moves file pointer to the beginning of the file. 29 putc() Writes a character to file. 30 sprint() Writes formatted output to string.
  • 14. 31 sscanf() Reads formatted input from a string. 32 remove() Deletes a file. 33 flush() Flushes a file.
  • 15. USER-DEFINED FUNCTION • A user-defined function is a function written by the user to write any program code and execute specific actions. • These user-defined functions can be modified and execute according to the requirement of the programmer. • A programmer can change the user-defined function, but these functions are not defined in the C header files. • A user-defined function is made up using the function declaration, function definition, and the function call.
  • 16. FUNCTION DEFINITION The function definition defines the actual body of the function that perform some specific tasks in a program. Syntax: return_type function_name (data_type arg1, data_type arg2, ... ) { // define the variables statement to be executed; return (expr); }
  • 17. FUNCTION CALLING • After defining the function definition, we need to call the defined function in a program to execute its tasks. • However, a function can be called multiple times by writing the function name followed by arguments lists. function_name(arg1, arg2, ...) Syntax: Here, arg1, arg2 are the actual arguments passed to the function_name.
  • 18. FUNCTION DECLARATION • The function declaration defines the function name, return type and the passed arguments in it. • A function definition is always defined outside of the main() function in any C program. Syntax: return_type function_name ( data_type arg1, data_type arg2, ..) ;
  • 19. LIBRARY FUNCTION • C programming language provides some library functions to perform some predefined tasks. • These functions are also called the built-in or predefined function in the C header files whose meaning cannot change. • When we use these functions on any program, we call the function name with appropriate header files because these functions are defined inside the header files. • In other words, we did not require to write the complete code to perform a specific task. For example: printf(), scanf(), getch(), etc., are the predefined library functions.