In programming, a function is a procedure that performs a specific task. It is a named block of code that can be called several times, from several different places, during a single execution of a program.

Most programming languages have prewritten set of functions called default functions that are kept in a library. One can also write one's own functions which is called user defined function to perform specialized tasks.

A function may have the following parts:

 - Function Name: The functions must have name and the name follow the naming conventions. 

 - Return Type: Returning data type of the function (void, integer, char, float etc.).

 - Parameters or Arguments: Parameters are placeholders that are passed into the function.

 - Function Body: Collection of statements that defines what the function actually does.


Function in C programming.

int print_result(int num1, int num2) 
   int result;
   return result; 
Share it:  Cite

More from this Section

  • C++ Programming Language
    C++ an Object-Oriented Programming language developed by Bjarne Stroustrup at Bell Laboratories ...
  • Polymorphism
    In object-oriented programming, Polymorphism means the ability to use same named method ...
  • Computer Programming
    Computer programming can be defined as creating or writing a sequence of instructions ...
  • Computer-Aided Engineering (CAE)
    Computer-Aided Engineering (CAE) refers the use of computers to guide or control the actual ...
  • Lisp Programming
    Because of the ease with which it can handle complex data structures, Lisp is used for ...