The error appears because you try to compare a literal string to a float value.
Your test for empty strings is also wrong. To check if a string is null or empty you should use the following code (assuming that type of fp
is char *
):
if(fp == NULL || *fp == '\0')
The sinfa
function doesn't have a valid prototype. Add type specifiers to the parameters num1
, num2
in the function definition.
And according to the Standard the prototype of the main
function should be either
int main(void)
or
int main(int argc, char *argv[])
Yours is wrong.
I suppose you're trying to check if there were errors during scanf
input conversion. In order to do that you should inspect the result of scanf
and check the gloval error state using the ferror
function (or check the errno
value directly).