SlideShare a Scribd company logo
3
Most read
4
Most read
5
Most read
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

PDF
User_Defined_Functions_ppt_slideshare.
PPT
User defined functions in C programmig
PDF
5. Functions in C.pdf
PPTX
Function C programming
PDF
Functions in c mrs.sowmya jyothi
PPTX
Module 3-Functions
PPTX
User defined function in c
PPTX
FUNCTIONS IN C.pptx
User_Defined_Functions_ppt_slideshare.
User defined functions in C programmig
5. Functions in C.pdf
Function C programming
Functions in c mrs.sowmya jyothi
Module 3-Functions
User defined function in c
FUNCTIONS IN C.pptx

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

PPTX
FUNCTIONS IN C.pptx
PPTX
C structure
PPTX
user-definedfunctions-converted.pptx
PDF
Unit 3 (1)
PPT
Ch4 functions
PPTX
unit_2.pptx
PPTX
Functions and Header files ver very useful
PPTX
user-defined_functionsin clanguage .pptx
PPTX
User Defined Functionscccccccccccccccccccccccccc.pptx
PPTX
Lecture_5_-_Functions_in_C_Detailed.pptx
PPTX
Function in c language(defination and declaration)
PPTX
Functions
PPT
U19CS101 - PPS Unit 4 PPT (1).ppt
PPTX
Programming_in_C_language_Unit5.pptx course ATOT
PDF
USER DEFINED FUNCTIONS IN C MRS.SOWMYA JYOTHI.pdf
PPTX
functions in c-1.pptxfunctions in c-1.pptx
PPTX
Funtions of c programming. the functions of c helps to clarify all the tops
PPTX
Built in function
DOC
Functions
FUNCTIONS IN C.pptx
C structure
user-definedfunctions-converted.pptx
Unit 3 (1)
Ch4 functions
unit_2.pptx
Functions and Header files ver very useful
user-defined_functionsin clanguage .pptx
User Defined Functionscccccccccccccccccccccccccc.pptx
Lecture_5_-_Functions_in_C_Detailed.pptx
Function in c language(defination and declaration)
Functions
U19CS101 - PPS Unit 4 PPT (1).ppt
Programming_in_C_language_Unit5.pptx course ATOT
USER DEFINED FUNCTIONS IN C MRS.SOWMYA JYOTHI.pdf
functions in c-1.pptxfunctions in c-1.pptx
Funtions of c programming. the functions of c helps to clarify all the tops
Built in function
Functions
Ad

More from LECO9 (20)

PPT
C Programming Intro.ppt
PPTX
Embedded Systems.pptx
PPTX
Basic Electronics.pptx
PPTX
Intro to Microcontroller.pptx
PPTX
PIC_Intro.pptx
PPTX
DATATYPES,KEYWORDS,FORMATSPECS[1].pptx
PPTX
STACKS AND QUEUES.pptx
PPTX
UNIONS IN C.pptx
PPTX
Processes, Threads.pptx
PPTX
OPERATORS IN C.pptx
PPTX
DATA STRUCTURES AND LINKED LISTS IN C.pptx
PPTX
DESIGN PATTERN.pptx
PPTX
INTER PROCESS COMMUNICATION (IPC).pptx
PPTX
cprogramming Structures.pptx
PPTX
POINTERS.pptx
PPTX
DYNAMIC MEMORY ALLOCATION.pptx
PPTX
cprogramming strings.pptx
PPTX
C-Programming Control statements.pptx
PPTX
C-Programming Function pointers.pptx
PPTX
C-Programming File-handling-C.pptx
C Programming Intro.ppt
Embedded Systems.pptx
Basic Electronics.pptx
Intro to Microcontroller.pptx
PIC_Intro.pptx
DATATYPES,KEYWORDS,FORMATSPECS[1].pptx
STACKS AND QUEUES.pptx
UNIONS IN C.pptx
Processes, Threads.pptx
OPERATORS IN C.pptx
DATA STRUCTURES AND LINKED LISTS IN C.pptx
DESIGN PATTERN.pptx
INTER PROCESS COMMUNICATION (IPC).pptx
cprogramming Structures.pptx
POINTERS.pptx
DYNAMIC MEMORY ALLOCATION.pptx
cprogramming strings.pptx
C-Programming Control statements.pptx
C-Programming Function pointers.pptx
C-Programming File-handling-C.pptx
Ad

Recently uploaded (20)

PDF
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
PPTX
CYBER-CRIMES AND SECURITY A guide to understanding
PDF
Embodied AI: Ushering in the Next Era of Intelligent Systems
PDF
R24 SURVEYING LAB MANUAL for civil enggi
PDF
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
PPTX
CH1 Production IntroductoryConcepts.pptx
PDF
Well-logging-methods_new................
PDF
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
PDF
Digital Logic Computer Design lecture notes
PDF
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
PDF
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
PPTX
UNIT-1 - COAL BASED THERMAL POWER PLANTS
PDF
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
PPTX
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
PDF
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
PDF
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
PPT
CRASH COURSE IN ALTERNATIVE PLUMBING CLASS
PPTX
Recipes for Real Time Voice AI WebRTC, SLMs and Open Source Software.pptx
PPTX
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
PDF
Model Code of Practice - Construction Work - 21102022 .pdf
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
CYBER-CRIMES AND SECURITY A guide to understanding
Embodied AI: Ushering in the Next Era of Intelligent Systems
R24 SURVEYING LAB MANUAL for civil enggi
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
CH1 Production IntroductoryConcepts.pptx
Well-logging-methods_new................
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
Digital Logic Computer Design lecture notes
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
UNIT-1 - COAL BASED THERMAL POWER PLANTS
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
CRASH COURSE IN ALTERNATIVE PLUMBING CLASS
Recipes for Real Time Voice AI WebRTC, SLMs and Open Source Software.pptx
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
Model Code of Practice - Construction Work - 21102022 .pdf

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.