C – Function

C functions are basic building blocks in a program. All C programs are written using functions to improve re-usability, understandability and to keep track on them. You can learn below concepts of C functions in this section in detail.

What is C function?

Uses of C functions

C function declaration, function call and definition with example program

How to call C functions in a program?

Call by value

Call by reference

C function arguments and return values

C function with arguments and with return value

C function with arguments and without return value

C function without arguments and without return value

C function without arguments and with return value

Types of C functions

Library functions in C

User defined functions in C

Creating/Adding user defined function in C library

Command line arguments in C

Variable length arguments in C

1. What is C function?

A large C program is divided into basic building blocks called C function. C function contains set of instructions enclosed by “{ }” which performs specific operation in a C program. Actually, Collection of these functions creates a C program.

2. Uses of C functions:

C functions are used to avoid rewriting same logic/code again and again in a program.

There is no limit in calling C functions to make use of same functionality wherever required.

We can call functions any number of times in a program and from any place in a program.

A large C program can easily be tracked when it is divided into functions.

The core concept of C functions are, re-usability, dividing a big task into small pieces to achieve the functionality and to improve understandability of very large C programs.