Nov 13, 2004 #1 maggmich Programmer Nov 13, 2004 1 AT Hello! Why shouldn't I implement a return-value f. ex. "return(0)" into a void function? I heard this once in terms of tidy programming. f. i.: Code: void writeString(char *str) { printf("%s",str); // return(0); ?????? I shouldn't! Why? } Yours Jürgen
Hello! Why shouldn't I implement a return-value f. ex. "return(0)" into a void function? I heard this once in terms of tidy programming. f. i.: Code: void writeString(char *str) { printf("%s",str); // return(0); ?????? I shouldn't! Why? } Yours Jürgen
Nov 13, 2004 #2 Salem Programmer Apr 29, 2003 2,455 GB The way you return from a void function is simply by doing Code: void writeString(char *str) { printf("%s",str); return; } -- Upvote 0 Downvote
The way you return from a void function is simply by doing Code: void writeString(char *str) { printf("%s",str); return; } --
Nov 13, 2004 #3 chipperMDW Programmer Mar 24, 2002 1,268 US Because it would be wrong and misleading. A function with a void return value does not return 0; it returns nothing. Upvote 0 Downvote
Because it would be wrong and misleading. A function with a void return value does not return 0; it returns nothing.