What is the Difference Between return 0 and exit(0) in a C++ Program

preview_player
Показать описание
In a C++ program, the main function often returns a value to the operating system. Usually this is accomplished by using the return keyword. However, we can also return a value by using the exit keyword. This video explains the difference between leaving a main function with return vs exit.

This channel, Paul Programming, provides helpful computer science tutorials with an emphasis on C++ and data structures. Paul is a professional software engineer and tutor who has a knack for explaining complex concepts in a simple and easy to understand way.

Please subscribe to this channel to benefit from the latest channel updates.

Thank you for watching! The success of this channel would never be possible without people like you! Thank you for your support!

STILL NEED MORE HELP?
Connect one-on-one with a Programming Tutor. Click the link below:

:)
Рекомендации по теме
Комментарии
Автор

8 years old but the explanation, examples used and video quality everything's so damn perfect

babusahabmishra
Автор

Thank you so much for clearing this up. It's something that I've always wanted to know!

KaranRajpal
Автор

Sir i understood the difference between exit and return .but why to use return or exit?

fakefake
Автор

your videos deserve much more attention

AdamDjellouli
Автор

exit is not a keyword, it is a function.

simonmaracine
Автор

+Paul Programming

Your Channel is so super for learing very interesting c++ stuff. Thx for your super helpful and very well explained videos.

pascalerkens
Автор

Thank you so much for this video, i could not get my if statement to stop running in my function!!!

riptide
Автор

Are there any videos where I can see "return 0" used for the purpose of telling whether a function worked successfully or not? I've seen that explanation given many times for why "return 0" is used, but I'd like to actually see an application where that turns out to be useful.

sicktoaster
Автор

+Paul Programming
Hey just wanted to ASK if you are still going to make vids?

pascalerkens
Автор

Why the video is called "... in a C or C++ Program" but the difference is shown using classes, which are only in C++? Is there any difference in C?

grihabor
Автор

if main prgm return 0 means prgm run success (true) if main return 1 or retrun -1 means ???

selvapriya
Автор

What is the difference between return 0 and return 1 in main function ?

selvapriya
Автор

Could you have done the same a "for " of "while " loop intered of the "do" loop.

ivaemply
Автор

Would an operating system also deallocate dynamically allocated memory?

Shadow
Автор

Pls what compiler are you using in this video?

basseygodwin
Автор

you cant use return outside the main function to exit the programm.

xCwieCHRISx