Order of functions matters?

I don't think the Arduino reference is right. Functions should be declared before they are used.

You can put an external declaration to your function near the top of your sketch:extern void freqout(int freq, int t);Then you can put your function anywhere you like since you have told the compiler about the functions's parameters and return value, so it knows how to call it.