Is it possible to write statements after return?

后端 未结 5 1285
遇见更好的自我
遇见更好的自我 2021-01-20 18:13

Is the return statement the last statement inside main or is it possible to write statements after return?

#include 

        
5条回答
  •  心在旅途
    2021-01-20 18:36

    is return statement the last statement inside main or is it possible to write statements after return?

    The run time behavior of executing a return statement is independent of the function. Be it main or some other other function, when a return statement is executed, nothing after that is executed in the function.

    It is possible to write statements after the return statement. They are superfluous since they are not executed. A smart compiler might be able to even omit creation of object code corresponding to the statements after the return statement.

提交回复
热议问题