Your are getting confused with localization of variables.
When you have something like this -
void fun1() {
int i;
i=4;
half(i); // result just going to the bit bucket...
print (i);
}
int half(int i) {
i = i/2;
return i;
}
you have 2 instances of i. one exists in fun1() and the other one exists in half(int i). and neither is global. and both are completely different variables.
if you want the return value to make it to fun1 you need to call half this way i = half(i). Otherwise the return value just goes to the bit bucket in the shy. So - your return value was just getting thrown out.
For i to have been a global variable it would have had to be defined before any functions and then your code would have worked. Globals have their place, where you need a value available everywhere. but it is poor practice to define all variables as globals, but we can often get away with it because our programs are small.