Sunday 15 January 2012

c++ - is return "nothing" permissible in a void function? -


I'm sorry but I'm still learning. And do not touch my reputation, please :) It's compiled, I just want to know whether there is a better solution or not. I am not getting this very beautiful if (value == 0) I want to get out of the function without doing anything.

  zero aspieio (int price) {if (value == 0) returns; MyArray [0] = value; }   

Is this the right way to exit zero function? I'm referring to the return that it came to my mind that I have never seen "nothing return" anything else "elegant"?

Thank you.

Is this the right way to exit zero function?

Yes, it is.

Anything more "elegant"

  zero espio (int value) {if (value! = 0) miere [0] = value ; }    

No comments:

Post a Comment