在进行分析之前先看一个例子:
例子1:
#include <iostream>
#include <stdio.h>
using namespace std;
static int x=3;
int foo1()
{
x+=2;
cout<<"the first value of x is:"<<x<<endl;
return x;
}
int foo2()
{
x+=2;
cout<<"the second value of x is:"<<x<<endl;
return x;
}
int main()
{
int i = 0;
cout<<"cout the value: "<<"i="<<i<<' '<<"i++="<<i++<<' '<<"i--="<<i--<<endl;
printf("printf the value: i= %d, i++= %d, i--= %d\n",i,i++,i--);
cout<<"the case 1: "<<endl;
cout<<"the value of foo1: "<<foo1()<<endl;
cout<<"the value of foo2: "<<foo2()<<endl;
return 0;
}
例子2:
#include <iostream>
#include <stdio.h>
using namespace std;
static int x=3;
int foo1()
{
x+=2;
cout<<"the first value of x is:"<<x<&