Question: What's the difference between:

```
void function();

int main()
{......}

void function()
{......}

```

vs

```
void function()
{.......}

int main();

```

It seems odd to declare a function before main then define it after main when you could just declare and define it before main. Is it for aesthetic purposes? My teacher writes functions like the first example.

Answer: 
Note I mean to make this answer supplementary, others have already given good answers to this questions. 

Note that knowing how to forward declare things in C++ becomes very important. Once you begin using header files it basically becomes mandatory. Header files will allow you to build a prototype of functions and classes/structs then define them in a corresponding .cpp file. This is a very important organizational feature of C++. 

```
// MyClass.h

class MyClass
{
public:
    MyClass(int x);
    void printInt();
private:
    int myInt;
};

// MyClass.cpp

MyClass::MyClass(int x)
{
    MyClass::myInt = x;
}

void MyClass::printInt()
{
    std::cout << MyClass::myInt;
}

```

Doing things this way makes it so you're not completely bound to make a huge hodgepodge of code. Especially if you're writing real programs that will have a considerably large amount of source code. 

So while in the question you asked forward declaring is really just more of a preference, later on it really won't be a choice.
Your first example is in the Top-Down style, the second in Bottom-Up style.

It's largely aesthetic, in that some people prefer one over the other.

For example, someone might prefer to get a high-level overview of the program before getting the details (top-down), while another might person might prefer to see the details first (bottom-up).

A tangible benefit of the declarations in the top-down approach is that you can more easily re-organize the function definitions without having to worry about ordering.