in the call stack, we say that after the function returns the value the call stack gets empty.
so, when we use ‘int’ return type in function then we can use return and when we can use ‘void’ it can not return the value so, in the case is call stack will empty or not ???
Problem regarding CALL STACK
hi @Shantanu07j in a function, as soon as the return keyword is encountered, it stops right there, and the flow of control goes to the previous function (from where the current function was called)
No matter what is the return type of that function, the scope of that function is destroyed and it is removed from the call stack.
The return type is useful for the function that called the other function, as the value returned will be used by that function only. If it is void, no value is returned, so no value can be used. If it is something else like int or char, then you can assign the returned value to any variable and use it later.
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.