#include <iostream>
using namespace std;
char fun(char *str)
{
return str[0];
}
void main()
{
char *s = "one", a[5] = {0}, (*f1)(char *) = fun, ch = 'a';
char ans = f1(&ch);
cout << ans << endl;
ans = (*f1)(s);
cout << ans << endl;
ans = f1(s);
cout << ans << endl;
cout << f1 << endl;
cout << *(f1) << endl;
/*
输出结果:
a
o
o
001F1032
001F1032
*/
}从输出结果上来看,加*与不加*的结果是一样的.
总感觉写法不一样,意义上应该有不同,求解答!!!
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/4547/viewspace-3165622/ ,如需转载,请注明出处,否则将追究法律责任。