Please i want to end a program in a function outside
function main.
also want to end executing a function of type void without
allowing it to end but don't know how.
please help me out.
capton 0 Newbie Poster
Recommended Answers
Jump to PostPlease i want to end a program in a function outside
function main.Is exit what you want?
also want to end executing a function of type void without
allowing it to endNot sure what "it" is at the end there... if you want to exit …
Jump to PostNo user-defined function can run outside main().
Assuming you mean that no user-defined function can run before main (ignoring that you seem to have misunderstood the OP), consider this:
#include <iostream> class foo { public: foo() { std::cout << "Me first!" << std::endl; } } obj; int …
Jump to PostWith what?
Formatting? OK, here.
Stopping the program from inside the function? Don't. It's a bad practice. Return a value that indicates what to do inmain()
Jump to PostYou need to include stdlib(.h?)
All 15 Replies
tkud 0 Posting Whiz in Training
gusano79 247 Posting Shark
Moschops 683 Practically a Master Poster Featured Poster
Narue 5,707 Bad Cop Team Colleague
LRRR commented: Whenever I read your post, I always learn something new. +2
PrimePackster commented: Can't resist adding reps... +0
tkud 0 Posting Whiz in Training
thines01 401 Postaholic Team Colleague Featured Poster
nezachem 616 Practically a Posting Shark
PrimePackster 10 Runaway Poster
capton 0 Newbie Poster
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague
Mr_Null_andVoid 0 Newbie Poster
capton 0 Newbie Poster
dmanw100 36 Posting Whiz in Training
capton 0 Newbie Poster
AceStryker 0 Light Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.