下面代码输出结果有何不同?

#include <iostream>
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();
    return 0;
}

输出结果:

2 1
1 2

posted @ 2013-07-02 15:39  hunterzhang  阅读(150)  评论(0编辑  收藏  举报