These function are the built-in functions i.e., they are predefined in the library of the C. These are used to perform the most common operations like calculations, updatation, etc. Some of the library functions are printf, scanf, sqrt, etc. To use this functions in the program the user have to use associate header file associated to the corresponding function in the program.
If, the user have to use print the data or scan the data using input stream then we have to use functions printf() and scanf() in C program and cin and cout in C++ program. To use these functions the user have to include #include<stdio.h> preprocesser directive in C program and #include<iostream> preprocesser directive in C++ program.
These functions are designed by the user when they are writing any program because for every task we do not have a library of functions where their definitions are predefined. To perform the according to the requirement of user the user have to develop some functions by itself, these functions are called user-defined functions. For such functions the user have to define the proper definition of the function.
For Example: If we want to perform the addition of two numbers then below is the program to illustrate the addition of two numbers using user-defined functions:
Sum is: 8
Tabular Representation to illustrate the difference between library and user-define function:
|User-defined Functions||Library Functions|
|These functions are not predefined in the Compiler.||These functions are predefined in the compiler of C language.|
|These function are created by user as per their own requirement.||These functions are not created by user as their own.|
|User-defined functions are not stored in library file.||Library Functions are stored in special library file.|
|There is no such kind of requirement to add the particular library.||In this if the user wants to use a particular library function then the user have to add the particular library of that function in header file of the program.|
|Execution of the program begins from the user-define function.||Execution of the program does not begin from the library function.|
|Example: sum(), fact(),…etc.||Example: printf(), scanf(), sqrt(),…etc.|
- Function Interposition in C with an example of user defined malloc()
- User defined Data Types in C++
- Multi-set for user defined data type
- User-defined Custom Exception with class in C++
- Difference between Single User and Multi User Database Systems
- Difference between Header file and Library
- Difference between Process and User Level Thread
- Difference between Virtual function and Pure virtual function in C++
- Difference between Function and Procedure
- Difference between Method and Function in Python
- What is the difference between a language construct and a “built-in” function in PHP ?
- Difference Between Daemon Threads and User Threads In Java
- Function Overloading vs Function Overriding in C++
- How to call some function before main() function in C++?
- Difference between User Level thread and Kernel Level thread
- How to call function within function in C or C++
- Difference between Function Oriented Design and Object Oriented Design
- Pattern Searching using C++ library
- boost::algorithm::none_of_equal() in C++ library
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.