warning: statement with no effect [-Wunused-value]错误示例
来源:互联网 发布:淘宝 一千零一夜 编辑:程序博客网 时间:2024/04/30 07:53
#include <stdio.h>
int main()
{
int i;
int j;
for(i=32,j=2;i++;i<256)
{
if((i%16==0)
{
printf("\n%d:",j);
j++;
}
printf("%c ",i);
}
return 0;
}
编译后报错:
~/run$ gcc -Wall -o ascii ascii.c
ascii.c: In function ‘main’:
ascii.c:7:2: warning: statement with no effect [-Wunused-value]
for(i=32,j=2;i++;i<256)
原因是:for格式用错:修改为: for(i=32,j=2;i<256;i++)后就ok
修改后的代码:
#include <stdio.h>
int main()
{
int i;
int j;
for(i=32,j=2;i<256;i++)
{
if((i%16)==0)
{
printf("\n%2d:",j);
j++;
}
printf("%c ",i);
}
printf("\n");
return 0;
}
执行结果:
2: ! " # $ % & ' ( ) * + , - . /
3:0 1 2 3 4 5 6 7 8 9 : ; < = > ?
4:@ A B C D E F G H I J K L M N O
5:P Q R S T U V W X Y Z [ \ ] ^ _
6:` a b c d e f g h i j k l m n o
7:p q r s t u v w x y z { | } ~
8:▒ ▒ ▒ ▒ ▒ ▒ ▒ ▒ ▒ ▒ ▒ ▒ ▒ ▒ ▒ ▒
9:▒ ▒ ▒ ▒ ▒ ▒ ▒ ▒ ▒ ▒ ▒ ▒ ▒ ▒ ▒ ▒
10:▒ ▒ ▒ ▒ ▒ ▒ ▒ ▒ ▒ ▒ ▒ ▒ ▒ ▒ ▒ ▒
11:▒ ▒ ▒ ▒ ▒ ▒ ▒ ▒ ▒ ▒ ▒ ▒ ▒ ▒ ▒ ▒
12:▒ ▒ ▒ ▒ ▒ ▒ ▒ ▒ ▒ ▒ ▒ ▒ ▒ ▒ ▒ ▒
13:▒ ▒ ▒ ▒ ▒ ▒ ▒ ▒ ▒ ▒ ▒ ▒ ▒ ▒ ▒ ▒
14:▒ ▒ ▒ ▒ ▒ ▒ ▒ ▒ ▒ ▒ ▒ ▒ ▒ ▒ ▒ ▒
15:▒ ▒ ▒ ▒ ▒ ▒ ▒ ▒ ▒ ▒ ▒ ▒ ▒ ▒ ▒ ▒
- warning: statement with no effect [-Wunused-value]错误示例
- warning:statement has no effect
- statement with no effect 解决
- PHP别名引用错误:“The use statement with non-compound name … has no effect”
- [转]warning C4552: '>>' : operator has no effect; expected operator with side-effect
- warning C4552: '>>' : operator has no effect; expected operator with side-effect
- [Warning] TIMESTAMP with implicit DEFAULT value
- Warning: file_exists(): open_basedir restriction in effect. File 错误的解决办法
- Statement lambda can be replaced with expression lambda 的Warning
- NO SQL statement available错误解决方法
- property value with CGLIB 错误
- 关于 clang 将 -Wunused-variable warning 视为 error 的问题
- warning:'ispExpInfoRotate180' declared 'static' but never defined [-Wunused-function]
- Warning:The `android.dexOptions.incremental` property is deprecated and it has no effect on the buil
- Warning:The `android.dexOptions.incremental` property is deprecated and it has no effect on the buil
- Warning:The `android.dexOptions.incremental` property is deprecated and it has no effect on the buil
- Warning:The `android.dexOptions.incremental` property is deprecated and it has no effect on the buil
- Warning:The `android.dexOptions.incremental` property is deprecated and it has no effect on the buil
- 28. Implement strStr() java
- 哈工大-2016级新生程序设计全国邀请赛 棋盘村
- css
- const关键字的作用
- 海凌科的无线wifi模块,趁着有空拿来玩玩
- warning: statement with no effect [-Wunused-value]错误示例
- 我所接触到的ES5还有console对象
- 反射的个人见解
- java 知识点(重要)
- Codeforces 629B Far Relative’s Problem【模拟】
- IAR 源代码拷贝到 MDK 乱码问题的解决办法
- 排序(全)
- Android 自定义圆形带刻度渐变色的进度条
- Tarjan 算法笔记