Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error in Borland

Status
Not open for further replies.

beradams

Vendor
Dec 21, 2005
3
US
Just started using Borland C compiler. I am trying to compile a simple program:

#include <stdio.h>
#include <math.h>

main()

void timestwo(double y[], double x[])
{
y [0]= 2.0 * x[0];
return;
}

... I keep receiving the error:
"Error 2141 timestwo.c 6: Declaration syntax Error"

Please help, it seems like such a simple program. I copied it right out of a C book. Thank you

 
Your [tt]main[/tt] function has no body. Perhaps this would be a better starting attempt.
Code:
#include <stdio.h>

void timestwo(double y[], double x[])
{
     y [0]= 2.0 * x[0];
     return;
}

int main()
{
   /* do stuff */
   return 0;
}
 
Thanks for the reply Dave,

I put in the code you recommended. Still gives the same error though. Shouldn't it still compile even when main is not doing anything? I believe the beginning is valid code. That's why I thought it might have something to do with the Borland compiler. Thanks in advance for help, and sorry for my C-stupidity.

Brad
 
Nevermind, you were right, I got it. Just saved to the wrong directory. thanks a ton,

B
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top