9

Code Blocks gone Mad XD😂😂😂
#factorial_of_5_is_6
😁😀😂😂

Comments
  • 4
    what even is this code?
  • 1
    @karwler friend did it XD
  • 9
    Well i aint a c master but this code gives me ptsd
  • 5
    Why for god sake would someone declare a function inside of a function 😵 that's not how it's meant to be!
  • 7
    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.
  • 1
    It's a GCC extension I guess. https://gcc.gnu.org/onlinedocs/gcc/...
  • 3
    My eyes! 😭 what have you done?!
  • 5
    The semicolon after the for loop is apparently interpreted as the body of the loop, gcc warns about it if you compile with -Wall.
  • 0
    I guess, this was not what you were "waiting for".
    Got it?
    Did you noticed that your second print is never called?
  • 0
    @the-nsa that's actually not even legal standard C code. Must've been written with some GNU extension
  • 0
    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.
  • 6
    I've registered an account just to express my pain after looking at this code.
  • 0
    This makes me want to drink....
  • 1
    @endor welcome to devrant i guess
  • 0
    @RazorSh4rk thanks! (To be fair, I was already going to join, but this thing actually made me pull the trigger :D )
Add Comment