Sqr | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Sqr

What’s that mean || Int(*fp)(int)=sqr ???

23rd Mar 2019, 9:27 PM
ikram naif
1 Answer
+ 3
int (*fp)(int) x; declares a pointer to a function of return type int, which takes one argument of type int. What you can achieve with this, is to create aliases to existing functions, such as int func(int p) { return p+1; } int (*fp)(int) x = func; You can then call func() using x. printf("%d", x(39)); // prints 40 Somewhat identical: https://code.sololearn.com/c7yvjIx5hWsw/?ref=app
24th Mar 2019, 2:36 AM
Hatsy Rei
Hatsy Rei - avatar