G
gk245
This is part of a bigger program, but i made it simple (basically the
OT_hours function is supposed to determine if the number entered is
over 40 hours or not and return the appropriate answer):
#include <stdio.h>
#include <stdlib.h>
struct person
{
float overtime;
float hours;
};
float OT_hours ( float hours )
{
struct person *empl;
if ( hours <= 40 )
{
empl->overtime = 0;
return ( empl->overtime );
}
else
{
empl->overtime = hours - 40;
return ( empl->overtime );
}
}
main ()
{
printf("%f", OT_hours(5));
}
And, the program crashes if compiled....i mean, i can't pass a integer
value to OT_hours? Gah, pointers are so confusing....
Thanks.
OT_hours function is supposed to determine if the number entered is
over 40 hours or not and return the appropriate answer):
#include <stdio.h>
#include <stdlib.h>
struct person
{
float overtime;
float hours;
};
float OT_hours ( float hours )
{
struct person *empl;
if ( hours <= 40 )
{
empl->overtime = 0;
return ( empl->overtime );
}
else
{
empl->overtime = hours - 40;
return ( empl->overtime );
}
}
main ()
{
printf("%f", OT_hours(5));
}
And, the program crashes if compiled....i mean, i can't pass a integer
value to OT_hours? Gah, pointers are so confusing....
Thanks.