0
why in this case we call the function in Main like that " int result = sum(x, y);" why no by just typing sum(x,y)?
1 Antwort
+ 2
Because sum(x,y) would just execute the function and give no output unless there is a cout command in the function
whereas int result = sum(x, y); will store the value returned by the function sum in variable result, for further use in the main function.