下面的代码因 EXC_BAD_ACCESS 而崩溃。任何人都知道为什么?
报告以下警告:
从“int”分配给“char *”的不兼容整数到指针转换
register int t;
char *s;
double val;
s = printn(val);
t = strlen(s); // <<< breaks on this line
...
char *printn(n)
double n;
{
register char *fmt, *s, *ss;
double absn;
short sign;
....
s = printb("%-0.2f", sign*absn);
for (ss = s; *ss; ++ss);
while (*--ss == '0' || *ss == ' ') *ss = 0;
if (*ss == '.') *ss = 0;
return(s);
}
谢谢你。