Tuesday, August 9, 2011

What does "return 1" do in a program in C?

If you wanted to use the result of the function elsewhere you could have the function return a value. In this case, that value is 1. This code will print the text foo to the screen, end the line, and at the end, return to the computer the value 1. Most functions will, based on what type of function it is, return some value to the computer. That is the use of the command return.

No comments:

Post a Comment