Void Functions and Jumps

Hello, i've already readed the functions section on the reference page of arduino, but i still have some doubts about it.
I really don't understand how the program flows (jumps and returns) to the loop function.

I want to make something like this:

void loop() {
functionReceiveMsg(); //All the stuff to receive the sensor reading with VirtualWire library
funcionDataConversion(); //To make some percentage of values and conversions (maths)
funcionClientOnline(); //To provide an html page to client (with Ethernet Shield) to client when requested
}

void functionReceiveMsg() {
... receive message code }

int funcionDataConversion() {
... data conversion and maths }

void funcionClientOnline() {
... Ethernet client stuff }

void htmlSdRead() {
...when it provides html pages from sd card to client it jumps to here }

My questions are:
1- If i change functionReceiveMsg(); with funcionClientOnline(); position in void loop() it makes any difference?
2- When program jumps to function it will return to void loop() position where it jumped or to the end of void loop()?
3- How can i return from int funcionDataConversion() two values: data percentage and battery level (for example)?
4- When it jumps to void htmlSdRead() it will read file from sd card and client.print it, after that it will continue the void funcionClientOnline() in the poinst where it jumped or return to void loop()?
5- Can you provide me any webpage that explains the jumps, voids and anything ralation to this and arduino for me to read and understand?

Thanks in advance!

1 yes it makes a difference. The functions are executed in turn in the order specified. If you put your shoes on and then your socks, is that different from doing it the other way round?

2 the function is executed and then returns to the statement after the function was called.

3 you can only return one value from a function. However, if you pass the pointer to a value into the function (probably an advanced topic for you right now) you can modify the original value that was passed in.

4 see the answer to 2 above

5 void is a keyword that means no data or no parameters. The rest is probably explained in any reasonable C or C++ tutorial online.

Personally I think you are over thinking this. The computer will execute the instructions in the order that you write them. That's it, simply put.

It is often easier to visualise the program as a tree, like a folder listing on your computer, where each function is a folder.

Where you have:

My Computer
+-- C:
|   +-- Users
|   `-- Windows
`-- D:

etc, use that same structure to visualise your program:

main()
+-- setup()
`-- loop()
    +-- functionReceiveMsg()
    +-- funcionDataConversion()
    `-- funcionClientOnline()

The order they are in the tree is the order they will be executed in. Of course, loop() itself is inside a while(1) loop, so will repeatedly call (not easy to show that in a tree), but it is good for working out the flow through your program of a single iteration. It can also help you to find recursive loops, too - say functionReceiveMsg() calls functionClientOnline(), which in turn calls functionReceiveMsg() - your tree will grow to an infinite depth and you will soon know that you have a problem.

It is often easier to visualise the program as a tree, like a folder listing on your computer, where each function is a folder.

Nice explanation majenko.... take a pound out the karma till 8)

Thank you all very much, it makes simplest the way i think about the program, and makes it easier to understand it and make it the way i want. Thanks a lot!

There is a hidden main() function which calls loop() over and over again.

You might try using the program you provided in the original post and have each function just print its name to serial. Then you can see exactly what order they get called in. Make loop and setup print their names too.

Excellent idea!

Useful tip:Serial.println (__func__);