Introduction to function in C Language


Introduction to function in C Language

It is defined as named block of statements .


  1. Easy to diagnose errors in program .
  2. Reduced complexity.
  3. Easier testing of a program .
  4. Functions help to divide big softwares into smaller sections.
  5. Reusability.
  6. Simple to understand .
  7. Efficient memory utilization.
  8. Reduces repetition of code.

Creating a function

The syntax for creating a function is

Type Fun_name(Parameters)
Variables ;
return( Value );


Type is the data types of value returned by function.

Fun_name is the  functions name  specified by the programmer.

Parameters are variables declared within parenthesis written after the function name. 

Variables are local variables declared within function body.

Statements is set of  instructions which would run when function is called.

return is used to return a value from function.

Value is any valid variable, constant or expression.

Best Books of Computer Science

Lesson tags: advantages of function in c, components of a function in c language, Defining a function in c language, Syntax of function in c language, what is a function in c
Back to: C Programming Language