函数指针数组的 出现访问错误
大神们,如下代码如下图,#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
char *mystrcat(char *a, char *b)
{
return strcat(a, b);
}
char *mystrcpy(char *a, char *b)
{
return strcpy(a, b);
}
char *mystrstr(char *a, char*b)
{
return strstr(a, b);
}
void main()
{
char *a = "huawei";
char *b = "jia you";
char *(*p[3])(a, b) = { mystrcat,mystrcpy,mystrstr};
printf("%s", (p[1])(a,b));
system("pause");
}