I have a void function that I want to leave before the end of the function is reached, dependant on IF functions.
I've tried return(); but compiler errors with "Return value not allowed in void function" - is there another command that will abort the function?
rnielsen
Joined: 23 Sep 2003 Posts: 852 Location: Utah
Posted: Thu Aug 17, 2006 8:38 am
Try:
return;
no ().
Ronald
Guest
Posted: Thu Aug 17, 2006 12:46 pm
Uhhh.....
Things like Label/Goto, End/Stop, Return in a void function just to make the code stop are all regarded as poor programming methods in C.
If you can't think of a logical way to end your code from inside a function (I doubt its nothing a clevel if/else couldn't do), then make it an int or int1 function and find a way to use the returned data to your advantage.
Its easy to program like that, but in the end it will bite your [spam].
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum