Functions in c programing language types of functions

Functions in c programing language :


what is function :

a function in c is a block of organized , reusable code that performs a specific task
(or )
a set of block of statements when called perform some specific task

reusability : define the code once and use it many times .
modularity : divide your programs into smaller , logical parts 
readability :  make your code easier to understand by encapusulating functionality 

syntax of functions in c : 

  • function declaration 
  • function defination
  • function calling 

function defination : 

syntax : 

void myfunction() {
//code to be executed
}

  • void indicates that the function doesn't return any value 
  • myfunction () the name of your function 
  • { }  you add the code that defines what that the function should do

function declaration  :

syntax

return_type function_name (parameters)

example 
int sum(inta,intb);


function calling : 

example 

void myfunction () {
printf("I just got executed "):   // function defination
}
int main() {
myfunction();  //function calling
return 0;
}

types of functi0ns :

Post a Comment

Please Select Embedded Mode To Show The Comment System.*

Previous Post Next Post