//BCA Support - www.bcasupport.xyz
#include <stdio.h>
int add(int x,int y)
{
return x+y;
}
int mul(int x,int y)
{
return x*y;
}
int sub(int x,int y)
{
return x-y;
}
void main()
{
//Declaring pointers to functions
int (*a)(int,int);
int (*m)(int,int);
int (*s)(int,int);
int x,y,z;
clrscr();
//Storing address in pointers
a=add;
m=mul;
s=sub;
//Calling functions using pointers
x=a(5,3);
y=m(5,3);
z=s(5,3);
//Printing values
printf("\nAdd\t\t: %d",x);
printf("\nProduct\t\t: %d",y);
printf("\nSubtract\t: %d",z);
getch();
}
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.