Function in C Programming Language

C Programming Language Function in C Language (Article) Function in C Language (Program)

958

Program:

#include <stdio.h>
 
/* function declaration */
int add(int num1, int num2);
 
int main () {

   /* local variable definition */
   int a = 100;
   int b = 200;
   int ret;
 
   /* calling a function to get add */
   ret = add(a, b);
 
   printf( "value is : %d\n", ret );
 
   return 0;
}
 
/* function returning the add between two numbers */
int add(int num1, int num2) {

   /* local variable declaration */
   int result;
  
   result = num1+num2;
 
   return result; 
}

Output:

value is : 300
Press any key to continue . . .
 

Explanation:

Function in C Programming Language

This Particular section is dedicated to Programs only. If you want learn more about C Programming Language. Then you can visit below links to get more depth on this subject.