Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
omom13597yWhy for god sake would someone declare a function inside of a function 😵 that's not how it's meant to be!
-
No. Codeblocks hasn't gone mad. Your code is wrong. You are calling the function (i.e. calculating the factorial) after printing "the factorial of x is y". And I have never seen nested functions in standard C, so I have to assume that they are not allowed. I don't even know why that code is allowed to compile.
Just a tip: If your code isn't working, it's never the IDE's fault. It is always yours. -
JoshuaS137yThe semicolon after the for loop is apparently interpreted as the body of the loop, gcc warns about it if you compile with -Wall.
-
Canilho3157yI guess, this was not what you were "waiting for".
Got it?
Did you noticed that your second print is never called? -
@the-nsa that's actually not even legal standard C code. Must've been written with some GNU extension
-
It also shouln't compile since the factorial-function is supposed to return an int. But it is printing the result and never returns it.
-
endor56667y@RazorSh4rk thanks! (To be fair, I was already going to join, but this thing actually made me pull the trigger :D )
Code Blocks gone Mad XD😂😂😂
#factorial_of_5_is_6
😁😀😂😂
undefined
#codeblocks #c #madness #factorial