读书人

TC2.0中scanf:floating point formats

发布时间: 2012-02-23 22:01:35 作者: rapoo

TC2.0中scanf:floating point formats not linked
编译通过,在输入数据返回结果时出现:
scanf:floating point formats not linked
应该怎么解决??这个问题是怎么出现的??请指教.谢谢~!


[解决办法]
把源码贴出来看下。。

[解决办法]
把%f 改成%g

[解决办法]
#include <stdio.h>
#include <malloc.h>
#define LEN sizeof(struct student)
struct student
{
long num;
float score;
struct student *next;
};
int n;
struct student *creat(void)
{
struct student *head;
struct student *p1,*p2;
int x;
float y;
n = 0;
head = (struct student *)malloc(LEN);/*creat a new space*/
printf( "please input the num&score: " );
scanf( "%ld,%f ", &x, &y );
head-> next = NULL;
p2 = head;
while( x != 0 )
{
p1 = (struct student *)malloc( LEN );
p1-> num = x;
p1-> score = y;
p1-> next = NULL;
n = n+1;
if( n == 1 )
head = p1;
else
p2-> next = p1;
p2 = p1;
scanf( "%ld,%f ", &x, &y );
}
p2-> next = NULL;
return(head);
}
LZ这样试下看编译输入时会不会出现
scanf:floating point formats not linked

读书人网 >C语言

热点推荐