#include <stdio.h>
#include <string.h>
int my_add(int data1, int data2)
{
return data1 + data2;
}
int my_sub(int data1, int data2)
{
return data1 - data2;
}
int my_mul(int data1, int data2)
{
return data1 * data2;
}
int my_div(int data1, int data2)
{
return data1 / data2;
}
void test00()
{
int data1 = 0;
int data2 = 0;
char cmd[128] = "\0";
char *buf[4] = {"add", "sub", "mul", "div"};
int row = sizeof(buf) / sizeof(buf[0]);
int (*p[4])(int data1, int data2) = {my_add, my_sub, my_mul, my_div};
printf("请输入 cmd data1 data2 :");
scanf("%s %d %d", cmd, &data1, &data2);
标签:return,sub,int,my,add,mul,data1,data2 From: https://blog.csdn.net/w1348469325/article/details/140265653