Floating point formats not linked

R

Ravi

Is there anything wrong with this program?

#include <stdio.h>

int main()
{
struct emp
{
char name[20];
float sal;
};

struct emp e[1];
int i;
for (i=0;i<=0;i++)
scanf("%s %f",e.name,&e.sal);
for (i=0;i<=0;i++)
printf("%s %f",e.name,e.sal);


return 0;
}
 
M

Malcolm

Ravi said:
Is there anything wrong with this program?

#include <stdio.h>

int main()
{
struct emp
{
char name[20];
float sal;
};

struct emp e[1];
int i;

for (i=0;i<=0;i++)
scanf("%s %f",e.name,&e.sal);

The loop is a bit confusing. Also scanf("%s", buff) is gets() in disguise.
for (i=0;i<=0;i++)
printf("%s %f",e.name,e.sal);

return 0;
}

If you are getting an error saying "floating point formats not linked" it
probably means that you are using a compiler for some small system where
floating point arithmetic is not included by default. You will have to look
at the documentation to see how to tell it to accept floats.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,262
Messages
2,571,043
Members
48,769
Latest member
Clifft

Latest Threads

Top