|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32 |
#include <iostream>using
namespace
std;int
main(){ char
*p=NULL; p="com\0hputer"; while(*p){ cout << *p; p++; } return
0;}输出com#include <iostream>using
namespace
std;int
main(){ char
*p=NULL; p="com0hputer"; while(*p){ cout << *p; p++; } return
0;}输出 com0hputer |
说明 字符串的0 其实是“0” 而不是 bool 的0
|
1
2
3
4 |
if(‘0‘=="0") { cout<<"y"; } |
error: ISO C++ forbids comparison between pointer and integer|
原文:http://www.cnblogs.com/newhcw/p/3527581.html