what is error in this codes please help me

int X=0;
void setup()
{ 
// put your setup code here, to run once:
  Serial.begin(9600);
X=sum(5,4);
Serial.println(x);
}

int  sum(int firstNum , int secondNum);
{
int  result =0;
result = firstNum + secondNum ;
return result ;
}

error

'sum' was not declared in this scope

You have to declare a prototype of the function before its first use/call

int  sum(int firstNum , int secondNum);

or move the function definition above.
Next problem is a semicolon in a definition. It should be:

int  sum(int firstNum , int secondNum)
{
}

You usually don't have to declare the prototype when using the Arduino IDE.The builder takes care of that.

You however did create a prototype by accident. As said above, remove that semicolon.

sterretje:
You usually don't have to declare the prototype when using the Arduino IDE.The builder takes care of that.

Ahh, yes it could work without. I am still using v1.0.6 without such feature.

Budvar10:
You have to declare a prototype of the function before its first use/call

int  sum(int firstNum , int secondNum);

or move the function definition above.
Next problem is a semicolon in a definition. It should be:

int  sum(int firstNum , int secondNum)

{
}

thanks you and thanks again for forum i love you

Budvar10:
I am still using v1.0.6 without such feature.

1.0.6 has automatic prototype generation. It's not quite as good as in the latest IDE versions but the times when it fails are still pretty rare. Once the bugs are fixed in sky1981's code, it will compile quite happily in 1.0.6 without a prototype for sum.