判断到了字符串的末尾
main()
{
int i=0 ;
char s[10];
scanf("%s",s);
while(s[i]!=''){ /*这里可以用'',也可以用'/0'来判断到了字符串的末尾*/
printf("s is not empty/n");
i++;
}
printf("now is empty");
}
/*按行输入到字符串数组
输入:要存放字符串的数组地址
*/
#include <stdio.h>
void LineInput(char s[])
{
char s[50];
int i=0;
while( (s[i++]=getchar()) !='/n' );
}
如要求一个数的最后一位不能用:
int x;
printf("%d",(x/10.0+floor(x/10.0))*10.0);
而应是:printf("%d",(int)(x/10.0+floor(x/10.0))*10.0);
%d不能输出FLOAT