Nested function: Difference between revisions

(Added GCC specific C implementation.)
Line 212:
 
=={{header|C}}==
I honestly never thought this task could ever be done in C and then I was surprised, again. It turns out that nested functions although not a C standard are supported by [https://gcc.gnu.org/onlinedocs/gcc/Nested-Functions.html GCC]. I have used anonymous functions in Java and frankly, I don't see any practical benefit other than making code even harder to read. Then again, that's one of the [http://www.ioccc.org/ strengths of C]. For example, I still have no clue how come the sprintf line is working correctly. I expected the first line of the list to be '1. second', but no, [http://www.netfunny.com/rhf/jokes/90q2/ode.html C is C is C].
 
'''IMPORTANT'''This implementation will only work with GCC. Go through the link above for details.
----
 
'''IMPORTANT''' This implementation will only work with GCC. Go through the link above for details.
<lang C>
/*Abhishek Ghosh, 6th October 2017*/
Line 260 ⟶ 263:
3. third
</pre>
 
=={{header|C++}}==
{{incorrect|C++|This code doesn't compile correctly with a C++11 compatible compiler. Please debug and fix.}}
503

edits