[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

sqrt C function(clarification)



I'm sorry not to have provided more information in my first e-mail although 
i'm very glad so many people responded to help, but i've done some more 
testing:

specifically i'm getting 'prase error in tmp/x' where x is a long string of 
characters that tends to change on every run of the complier (at least when 
i'm compiling other programs). I've tried the following and gotten no errors

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

double num=16.0;

int main()
{ 
     double sqrt(double num);
return(0);
}

the following warns me that 'function sqrt does not match global variable' 
but still compiles

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

float num;

int main()
{ 
     float sqrt(float num);
return(0);
}

and this one just doesn't work at all giving the parse error previously 
described:

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

double num;

int main()
{ 
      num = 16; /*i've also tried 16. and 16.0 here*/
      double sqrt(double num);
return(0);
}

I'm sorry I was not more clear with my first e-mail and hope this points out 
the problem better.  Also, how do I let gcc know that I want math.h to be an 
available library so i dont' have to use the -l option every time if run it?

one final thing: did any of you try comiling the non-working examples on your 
gcc's? did you get any errors?

thanks a lot



Reply to: