帮偶解决一个malloc函数的问题
dousp 2003-08-20 10:31:25 #include "stdio.h"
#include "alloc.h"
struct s
{
long i;
long f;
};
main()
{
struct s *p1;
p1 = (struct s*)malloc(sizeof(struct s));
printf("input num:\n");
scanf("%d,%d",&p1->i,&p1->f);
printf("%d,%d\n",p1->i,p1->f);
getchar();
}
运行上面的例子,结果是:
input num:
10,20
10,3034
可是偶的本意是:
input num:
10,20
10,20
不知错在哪里?