Link to home
Start Free TrialLog in
Avatar of umaiyer
umaiyer

asked on

Floating point

I have the following code

void main()
{
     struct emp
    {
          char name[20] ;
          float salary ;
    };
    struct emp e[10] ;
    int i ;
    printf ( "Enter the names and salaries of employees\n" ) ;
    for ( i = 0 ; i <= 9 ; i++ )
       scanf ( " %s %f", e[i].name , &e[i].salary ) ;
}
Problem:
I don't have any compilation error.But when i try to execute the program & accept the floating point value, program crashes.I know that this is because of floating point emulator is not initialized and generally happens when we access the float member of the structure before any float variable.
How to initialize this.I am working on VC++ environment.

ASKER CERTIFIED SOLUTION
Avatar of WiB
WiB

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial