Function execution in Arduino sketch

Does the order in which functions are written affect the execution of code?
I have written a function LogtoSD to create a CSV file on SD card and write data to it,
I call it in Setup function because I want to run it only once.

I have written the LogtoSD function below the setup function.
It works fine till here.

I want to write data in the same file in loop.
so below LogtoSD function, I have written a similar code in Loop function.
But the file is not getting opened.

Does the sequence of writing function matters?

No.

It must be some other problem with the code you didn't post

sarveshchaudhari:
Does the sequence of writing function matters?

It does not matter from execution point of view; but from the view point of Literate Programming Style, first comes the setup() function, then the loop() function and then all other user defined functions chronologically. For example:

void setup()
{
    myFunction1();
    myFunction2();
}

void loop()
{
    myFunction3();
}

void myFunction1()
{

}

void myFunction2()
{

}

void myFunction3()
{

}

Aren't there some cases where the IDE fails to find functions at the bottom, and they do require to be above where they're called from, or at least be prototyped at the top?

fishboneDiagram:
Aren't there some cases where the IDE fails to find functions at the bottom, and they do require to be above where they're called from, or at least be prototyped at the top?

The IDE isn't good at prototyping functions with defaulted parameters, but I think in such cases, the code simply fails to compile, so couldn't produce the behaviour described.

TheMemberFormerlyKnownAsAWOL:
but I think in such cases, the code simply fails to compile

Ah, ok.