How do I allocate memory to the following function pointer: void (*ptr)(int*) = factorial;? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

How do I allocate memory to the following function pointer: void (*ptr)(int*) = factorial;?

https://code.sololearn.com/cSRannZuLu0S/?ref=app

24th May 2022, 7:39 PM
attackhelicopter boi
attackhelicopter boi - avatar
1 Answer
+ 3
These pointers are used when the type of the variable is not known. Since void has no type, the operation of unaddressing (taking the contents) and address arithmetic are not applicable to it, since the data representation is unknown.
25th May 2022, 5:57 AM
Ulysses Apokin
Ulysses Apokin - avatar