刚看到一份代码片段,求输出结果
char str[] = "blablabla"; int a = -1; while( a < sizeof(str)/sizeof(char) - 1 ) { cout<<(*(str + a + 1)); a++; }
其实就是无符号数与有符号int的比较,结果当然是没有输出的。因为a=-1自动转换成最大的0xffffffff,判断肯定是否定的。