Functions and stack order related

Is it necessary to make function above the main as the stack figure shows like can we first create a main then go to create a function.