+ 1

Someone please explain this to me!

I have marked my doubts inside the code: https://code.sololearn.com/cJntsie2uds2/?ref=app

18th Mar 2019, 11:20 AM
Soham Roy
Soham Roy - avatar
1 Antwort
- 1
Since 'func' in this particular case is one of the input parameters given to the defined function 'do_twice', just as 'x' and 'y'. Here, func is some sort of pointer to the also defined function add() What you actually doing is to tell do_twice what to do by providing the function pointer and on what to do this operation by giving two input arguments, x and y. In fact the 'add' code is executed three times ((10 + 5) + (10 + 5)). You can use the Debugger to see what code gets executed and what the current values of variables are.
18th Mar 2019, 1:39 PM
ChrA
ChrA - avatar