对c/c++指针的一个总结
int * p = new int(10);
int *p = new int [10];
#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
void f()
{
cout << "f" << endl;
}
int main()
{
void (*p)() = f;
(*p)();
p();
return 0;
}
(*p)()
是标准写法,p()
是简单写法
#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
int* f(int [100],double)
{
cout << "f" << endl;
}
int main()
{
int* (*p)(int[100],double) = f;
(*p)(nullptr,double());
return 0;
}
原文:https://www.cnblogs.com/XDU-mzb/p/14999097.html