Professional Documents
Culture Documents
Get (https://www.programiz.com/learn-c?utm_campaign=programiz-
Search tutorials and examples
App(/)homepage&utm_source=programiz-website-c-app-popup)
www.domain-name.com
C Functions
In this tutorial, you will be introduced to functions (both user-defined and standard
library functions) in C programming. Also, you will learn why functions are used in
programming.
Video: C functions
(https://www.programiz.com/learn-c?utm_campaign=programiz-
Getcreate aSearch
circletutorials
function and examples
App(/)homepage&utm_source=programiz-website-c-app-popup)
Dividing a complex problem into smaller chunks makes our program easy to
understand and reuse.
Types of function
There are two types of function in C programming:
header file.
Hence, to use the printf() function, we need to include the stdio.h header file
using #include <stdio.h> .
The sqrt() function calculates the square root of a number. The function is
defined in the math.h header file.
www.domain-name.com
How user-defined function works?
#include <stdio.h>
void functionName()
... .. ...
... .. ...
int main()
{
... .. ...
... .. ...
functionName();
... .. ...
... .. ...
void functionName()
Thank you for printing our content at www.domain-name.com. Please check back soon for new
contents.
And, the compiler starts executing the codes inside functionName() .
Get (https://www.programiz.com/learn-c?utm_campaign=programiz-
App(/)
Search tutorials and examples
The control of the program jumps back to the main() function once
homepage&utm_source=programiz-website-c-app-popup) code inside the
function definition is executed. www.domain-name.com
Working of C Function
This is just an overview of user-defined functions. Visit these pages to learn more on:
3. A large program can be divided into smaller modules. Hence, a large project can
be divided among many programmers.
Next Tutorial:
(/c-programming/c-user-defined-functions)
C User-defined Functions
Previous Tutorial:
(/c-programming/c-decision-making-loops-examples)
Control Flow Examples
Share on:
(https://www.facebook.com/sharer/sharer.php? (https://twitter.com/intent/tweet?
u=https://www.programiz.com/c- text=Check%20this%20amazing%20
programming/c-functions) programming/c-functions)
Get (https://www.programiz.com/learn-c?utm_campaign=programiz-
Search tutorials and examples
App(/)homepage&utm_source=programiz-website-c-app-popup)
www.domain-name.com
Related Tutorials
C Tutorial
C User-defined functions
(/c-programming/c-user-defined-functions)
C Tutorial
(/c-programming/library-function)
C Tutorial
(/c-programming/string-handling-functions)
C Tutorial
C Function Examples
(/c-programming/c-functions-examples)