[C/C++]warning: format '%c' expects argument of type 'char*', but argument 2 has type 'int' [-Wforma
来源:互联网 发布:淘宝开书店是什么类目 编辑:程序博客网 时间:2024/06/05 04:11
int Add(ZGGZ tp[],int n){ char ch ,num[10]; int i,flag=0;//flag 标记是否已经存在 system("cls");
if(flag == 0) { printf("sorry, %s is already exist,try again? Y/N?",num); scanf("%c",ch); if (ch == 'Y'|| ch == 'y') continue; else return n;
编译后错误信息提示:
SalaryManager.cpp|180|warning: format '%c' expects argument of type 'char*', but argument 2 has type 'int' [-Wformat]|
解决办法:
scanf("%c",&ch);
原因:scanf里面用的是地址,不是变量名
intscanf(constchar*format,...);
函数 scanf() 是从标准输入流stdin (标准输入设备,一般是键盘)中读内容的通用子程序,可以说明的格式读入多个字符,并保存在对应地址的变量中。
其调用形式为: scanf("<格式说明字符串>",<变量地址>);变量地址要求有效,并且与格式说明的次序一致。
0 0
- [C/C++]warning: format '%c' expects argument of type 'char*', but argument 2 has type 'int' [-Wforma
- linux c之提示format‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long int’ [-Wformat
- inet_ntoa warning: format '%s' expects type 'char *', but argument 2 has type 'int'
- jni编译时出现:warning: format '%d' expects argument of type 'int', but argument 4 has
- 编译告警:“warning: format '%d' expects type 'int', but argument 4 has type 'unsigned long'”
- inet_ntoa编译提示警告: 格式 ‘%s’ expects argument of type ‘char *’, but argument 2 has type ‘int’ [-Wformat]
- 解决 format ‘%x’ expects type ‘unsigned int’, but argument 2 has type ‘int *’
- g++编译报错原因分析 format ?.d?.expects argument of type ?.nt?. but argument 3 has type ?.
- warning: format ‘%s’ expects argument of type ‘char *’和warning: backslash and newline separated by
- expected 'float **' but argument is of type 'float (*)[5]'
- warning: non-variable type argument Int in type pattern scala.collection.mutable.WrappedArray[Int] i
- TypeError: argument of type 'int' is not iterable
- warning: passing argument 2 of 'request_irq' from incompatible pointer type导致的中断申请失败和
- warning: passing argument 2 of 'request_irq' from incompatible pointer type导致的中断申请失败和
- 错误argument of type "char *" is incompatible with parameter of type "LPCWSTR"的解决方法
- 错误argument of type "char *" is incompatible with parameter of type "LPCWSTR"的解决方法
- 错误argument of type "char *" is incompatible with parameter of type "LPCWSTR"的解决方法
- 错误argument of type "char *" is incompatible with parameter of type "LPCWSTR"的解决方法
- Jquery的$命名冲突
- name-->resID
- 乱码问题总结
- 何必要那么多的借口。。让我内疚自己还爱的不够
- android手机安全性测试手段
- [C/C++]warning: format '%c' expects argument of type 'char*', but argument 2 has type 'int' [-Wforma
- 全文检索技术与Lucene的使用
- 数据智能化处理助品牌企业良性管理电商渠道
- Struts2文件下载中文乱码解决方案
- Java Swing界面编程(14)---JTabbedPane
- 命令行cmd下获取路径的命令
- Python 标准库 urllib2 的使用细节
- [Wikioi 1021]玛丽卡(疑难题)
- Android中的短息备份器源码