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.All functions run in main(), since it's the entry point of the program. No user-defined function can run outside main(). Once main() ends, all other functions end.
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 Postalso want to end executing a function of type void without
allowing it to end but don't know how.Stick return; where you want it to end.
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 …
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.