
-----------------------------------
Aenoc
Wed Nov 05, 2008 8:34 pm

error, idk how to fix...
-----------------------------------
here is my code,,.... it has 2 functions, 1 to raise a float number. say 3.4 to 4, and 1 to lower a float say 3.4 again, to 3....
when i compile the program it reads two errors.
1)  line 28: warning: old-style declaration or incorrect type for: Uceil
2)  line 36: warning: old-style declaration or incorrect type for: Ufloor
can anyone help???. its just practise for a midterm so no marks for it but i dont get why its doing it.. lol so may cause things on midterm...

#include 

/* function proto.s */
int Uceil  (float);
int Ufloor (float);

void main(void)

{

float num1, num2, num3, num4;
int   V;

printf ("Please type in the values of the 4 numbers.\n");
scanf ("%f %f %f %f", &num1, &num2, &num3, &num4);

V = (Uceil(num1) + Ufloor(num2) - Uceil(num3)) * Ufloor(num4);

printf ("The expression is V = (Uceil(%f) + Ufloor(%f) - Uceil(%f)) * Ufloor(%f).\n", num1, num2, num3, num4);
printf ("The resulting value is: %d.\n", V);

}

/* function definitions */

Uceil (float num_up)

{
int tempV;
tempV = (int) num_up++;
return (tempV);
}

Ufloor (float num_dwn)

{
int tempV;
tempV = (int) num_dwn;
return (tempV);
}



Mod Edit: Remember code tags! :) [code]Code Here[/code]

-----------------------------------
OneOffDriveByPoster
Wed Nov 05, 2008 9:44 pm

Re: error, idk how to fix...
-----------------------------------
You have
void main(void)
and
Uceil (float num_up).

Both are bad.

The first because main() should be declared to return int in standard C.
The second because you are missing the return type--that is, you are using "implicit int".

There are more issues really, but I think you could figure them out.

-----------------------------------
Aenoc
Wed Nov 05, 2008 9:51 pm

Re: error, idk how to fix...
-----------------------------------
ok that was a quick fix =P sumtimes im stupid. thx

-----------------------------------
wtd
Wed Nov 05, 2008 10:21 pm

RE:error, idk how to fix...
-----------------------------------
It's not your fault that you missed the fixes.

C is a very permissive language.  You can make mistakes and it'll still work... but just in some different way than you expected.  Experience gives you the ability to deal with this effectively.
