A community for students.
Here's the question you clicked on:
 0 viewing
atjari
 3 years ago
Can someone explain me why we put return 0?
atjari
 3 years ago
Can someone explain me why we put return 0?

This Question is Closed

atjari
 3 years ago
Best ResponseYou've already chosen the best response.1And also where we put that?

agdgdgdgwngo
 3 years ago
Best ResponseYou've already chosen the best response.3programs return 0 when they exit to let the OS know that it has terminated successfully and nothing has gone wrong. something like "return 0" should exist somewhere within the main function of your C/C++ program

atjari
 3 years ago
Best ResponseYou've already chosen the best response.1we also put system 'pause' right. then y is that

agdgdgdgwngo
 3 years ago
Best ResponseYou've already chosen the best response.3system("pause"); is not really needed; it's used because when you run it on windows, the "cmd" window opens/closes really fast.

atjari
 3 years ago
Best ResponseYou've already chosen the best response.1in some codings where we use sub functions we put return name, return regno etc. y is that?

agdgdgdgwngo
 3 years ago
Best ResponseYou've already chosen the best response.3we do that because it's how we program; we compose our programs from these subroutines/procedures that return a value or change state.

agdgdgdgwngo
 3 years ago
Best ResponseYou've already chosen the best response.3you do get similar output in both programs, with slight differences in the way the functions work (second one has string exist in one frame, etc.).

atjari
 3 years ago
Best ResponseYou've already chosen the best response.1If u dnt mind cn u tel me in which case u use 1st one and which case u use the second.

agdgdgdgwngo
 3 years ago
Best ResponseYou've already chosen the best response.3With the first one, you can reuse the display() function if you ever want to get string input from the user. With the second one, you use it if you want to reuse the ability to have the user enter a string, and then echo it as "Name is\t" + hisname

agdgdgdgwngo
 3 years ago
Best ResponseYou've already chosen the best response.3What I can do if I used version 2: http://ideone.com/AKT0r contrast with what i can do with version 1 http://ideone.com/AXfKR

atjari
 3 years ago
Best ResponseYou've already chosen the best response.1Thanx a lot for ur great help.
Ask your own question
Sign UpFind more explanations on OpenStudy
Your question is ready. Sign up for free to start getting answers.
spraguer
(Moderator)
5
→ View Detailed Profile
is replying to Can someone tell me what button the professor is hitting...
23
 Teamwork 19 Teammate
 Problem Solving 19 Hero
 Engagement 19 Mad Hatter
 You have blocked this person.
 ✔ You're a fan Checking fan status...
Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.