As examples:
Code:
void doSomething(int number)
{
for (int i = 0; I < number; i++)
{
printf("Hi");
}
}
int multiplyByTwo(int number)
{
return number*2;
}
int main(int argc, char* argv[])
{
int newNumber = multiplyByTwo(3);
doSomething(newNumber);
return 0; // Indicates that the program finished without errors.
}
multiplyByTwo returns a variable of type integer. Thus, in my main function I can say
Code:
int newNumber = multiplyByTwo(3);
and newNumber will be equal to the returned result, 6 in this case.
On the other hand, doSomething has a return type of void, meaning it returns nothing. doSomething is a function that takes an int, goes and does something with it, but doesn't return anything back to main() when it's done. That doesn't mean it's useless though - it prints "Hi" as many times as its told to in the number it takes as an argument.
I could combine the first two statements of main() to be just:
Code:
doSomething(multiplyByTwo(3));
multiplyByTwo(3) returns 6 and instantly passes it as an argument to doSomething(), which will then print "Hi" six times.
I hope that's helpful.
I recommend Learn C The Hard Way, a free ebook. Google it.