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

  • Variable
    Variable is a computer programming term which refers to a named memory location (storage) ...
  • Bit
    Bit is an electronic signal that denotes a zero or a one; the smallest unit of representation ...
  • Inheritance
    Inheritance is the most important feature of Object-Oriented Programming. Inheritance ...
  • Data Types
    Generally data types refer to the classification of various types of data that a computer ...
  • Arithmetic unit
    Arithmetic unit is the unit of the computer that performs mathematical computations on ...