C语句常见的错误

来源:互联网 发布:淘宝灯具3c认证怎么办 编辑:程序博客网 时间:2024/05/18 18:46
 

 C语句常见的错误:

1

printf("%f\n",10/3);

printf("%f\n",(duoble)10/3);

printf("%f\n",(duoble)(10/3));

 

输出结果:0.000000

                    3.333333

                    3.000000

 

2

char *str  = "abcdef";

*str = 'x';

 

编译错误:原因此字符串数据存于只读段中,不能改变

原创粉丝点击