两个程序
#include<bits/stdc++.h>
using namespace std;
vector<int> l(1,0);
int newnode(){
return 5;
}
int main(){
l.push_back(6);
l.push_back(6);
l.push_back(6);
for(int i=1;i<=3;++i){
l[i]=newnode();
cout<<i<<' '<<l[i]<<endl;
}
return 0;
}
#include<bits/stdc++.h>
using namespace std;
vector<int> l(1,0);
int newnode(){
l.push_back(0);
return 5;
}
int main(){
l.push_back(6);
l.push_back(6);
l.push_back(6);
for(int i=1;i<=3;++i){
l[i]=newnode();
cout<<i<<' '<<l[i]<<endl;
}
return 0;
}
一个输出:
1 5
1 5
1 5
另一个输出:
1 6
1 5
1 5
为什么啊?