adsense

Hii, welcome to my site. My name is Om prakash kartik. This blog helps you to learn programming languages concepts.

Program in C to passing function as an argument

Program in C to passing function as an argument



#include<stdio.h>
#include<conio.h>
 int Fun(int x(int,int),int i,int j)
   {
   return x(i,j);
   }
   //Addition
 int add(int a,int b)
   {
    return (a+b);
   }
   //Multiplication
  int mul(int a,int b)
    {
     return (a*b);
 }
 int main()
  {
   int m,a,b;
   printf("Enter two number:-");
   scanf("%d%d",&a,&b);
        m=Fun(mul,a,b);
   printf("Multiplication = %d ",m);
   
   m=Fun(add,a,b);
   printf("\nAddition = %d ",m);
  }
Output:-






Post a Comment

0 Comments