0
Return function from function
Hi! I am having some trouble understanding pointers. I think that *someptr = value pointer is pointing to / pointer declaration &somevar = address of value someptr = address pointer is pointing to. I'm trying to return a pointer to a function from inside of a function, but it doesn't work. I'll add the code bit here. Thanks in advance! https://code.sololearn.com/cDamsXApQ2Mu/?ref=app
2 Respostas
0
I thought it may have something to do with data types, but how could I fix them?
If it indeed is impossible to declare a function inside another function and return it, then I guess I will have to come up with a different solution.
0
The code has a problem in the line printf("%i", *func(i));. The function func returns an integer, but the code is trying to dereference it as a pointer. To fix this, remove the asterisk before func(i). The corrected line should be printf("%i", func(i));