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

Function pointer help

https://code.sololearn.com/cpNM2pl58PMv/?ref=app Here, why aren't we using double quotes in {add,sub,mul,div} . In my previous lesson I learnt that *name[ ] , is called array to string and is used to store pointer to the strings. Now here, is it because the function is already declared so we just store it in the array? Next, why is the return type of the function pointer int int (*fun1[4])(int,int) Is it because the add, sub functions return so we gotta give this int as well? And this is the code from the lesson, please help

22nd Jul 2021, 4:07 PM
Srinath
2 Answers
0
NotAPythonNinja thanks that was really helpful. But what do you mean by function name is actually a pointer to the beginning of function? What output will I get when I dereference a function? As you explained with string example, as string is made of group of characters so first letter will be printed. But what in the case of function, what will be the output?
23rd Jul 2021, 5:56 AM
Srinath
0
NotAPythonNinja Thanks I get it clearly now👍
23rd Jul 2021, 6:43 AM
Srinath