C warning“comparison between pointer and integer [enabled by default]”
2012-08-07 09:39
253 查看
一个小程序
#include <stdio.h>
void PrintHello(void)
{
char ptr[] = "Hello wordl";
printf("%s\n",ptr);
return;
}
char *GetString(char *dest,const char *src)
{
char *temp = dest;
while(*src != 'NULL')
*dest++ = *src++;
return temp;
}
报警告 warning“comparison between pointer and integer [enabled by default]”
~
当src是char 类型到时候,应该用'\0' or 0;
while(*src != '\0')
#include <stdio.h>
void PrintHello(void)
{
char ptr[] = "Hello wordl";
printf("%s\n",ptr);
return;
}
char *GetString(char *dest,const char *src)
{
char *temp = dest;
while(*src != 'NULL')
*dest++ = *src++;
return temp;
}
报警告 warning“comparison between pointer and integer [enabled by default]”
~
当src是char 类型到时候,应该用'\0' or 0;
while(*src != '\0')
相关文章推荐
- [Error] ISO C++ forbids comparison between pointer and integer [-fpermiss
- Flex: yylval warning: assignment makes pointer from integer without a cast [enabled by default]
- 关于警告:initialization from incompatible pointer type [enabled by default]
- Ordered comparison between pointer and zero ('const char *' and 'int')
- A warning - comparison between signed and unsigned integer expressions [-Wsign-compare]的解决方法
- comparison between distinct pointer types 'QPushButton*' and 'QAbstractButton*' lacks a cast
- Difference between string created by array and pointer
- JNI - Divide by Zero. A comparison between Java and C(1)
- warning: assignment from incompatible pointer type [enabled by default]
- Failed to write core dump. Minidumps are not enabled by default on client versions of Windows
- UE4插件"EnabledByDefault" : true
- Data access between different DBMS and other txt/csv data source by DB Query Analyzer
- 在Eclipse中运行Android程序报 Failed to write core dump. Minidumps are not enabled by default on client versions of Windows 解决方法
- test the difference between "DEFAULT NULL" and "DEFAULT 0"
- 【C】编译提示 warning: incompatible implicit declaration of built-in function ‘calloc’ [enabled by default]
- [dynamic FL]part 6:comparison between Dynamic and Static
- more effective c++:the difference between pointer and reference
- Data access between different DBMS and other txt/csv data source by DB Query Analyzer
- [AngularJS] Default Child state and nav between child state
- test the difference between "DEFAULT NULL" and "DEFAULT 0"