Skip to content

Instantly share code, notes, and snippets.

@ZikiSoy
Created May 29, 2020 09:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ZikiSoy/394abf58cab924a4497c6755ddefeefe to your computer and use it in GitHub Desktop.
Save ZikiSoy/394abf58cab924a4497c6755ddefeefe to your computer and use it in GitHub Desktop.
typedef const char* pFunc(const char*);
typedef const char* (*pFunc2)(const char*);
const char* func1(const char * p)
{
cout << p << endl;
return p;
}
int main()
{
pFunc *c;
c = func1;
pFunc* c2 = func1;
pFunc* c3(func1);
pFunc* c4(&func1);
c("123");
c2("123");
c3("123");
c4("123");
// pointer to function
pFunc2 d1 = func1;
pFunc2 d2;
d2 = func1;
d1("123");
d2("123");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment