When I try to compile my program I get this message "greedy.c:5:11: error: initializing 'float' with an expression of incompatible type 'float (void)' float y=GetFloat; ^ ~~~~~~~~" The carrot(I think that is what this is called^)is under the y
GetFloat from the CS50 library takes no arguments. The way you call it is as follows
GetFloat(); // NOTICE the empty parentheses
If you wanna assign the result returned by
GetFloat to a
float variable, you may do it that way
float f = GetFloat();
If you're curious about why the compiler gives you this error message, this is because a name of a function without the parentheses is treated as a pointer to a function. The compiler thinks you're trying to assign a pointer to a function to a variable of type
float which is clearly a violation of the type-checking rules.
If you haven't got to pointers yet, just don't worry about that!