摘要:
#include using namespace std;int main(){ int b=3; int arr[]={6,7,8,9,10}; int *ptr=arr; *(ptr++)+=123; cout<<*ptr<<' '<<*(++ptr)<<endl; return 0;}输出结果为:8 8注意:printf和cout一样都是从右到左压栈的。 阅读全文
摘要:
#include using namespace std;void test1(){ int a,x; for(a=0,x=0;a<=1&&!x++;a++) a++; cout<<a<<" "<<x<<endl;}void test2(){ int a,x; for(a=0,x=0;a<=1&&!x++;) a++; cout<<a<<" "<<x<<endl;}int main(){ test1(); test2 阅读全文
摘要:
#include using namespace std;int func(int x) //函数的关键代码{ int count=0; while(x) { x=x&(x-1); count++; } return count;}int m... 阅读全文