So what does “return 0” actually mean?

后端 未结 6 596
谎友^
谎友^ 2020-12-08 12:02

I\'m pretty proficient in PHP, but I\'ve started dabbling with C. I\'ve seen the code

return 0;

at the end of functions that don\'t return

6条回答
  •  -上瘾入骨i
    2020-12-08 12:37

    Functions in C return int by default, if no other return type is defined. return 0 would be good practice to make sure the function returns a known value, as opposed to some random value, in case the caller is looking at the return value.

提交回复
热议问题