gpt4 book ai didi

c++ - 请解释这个歧义?

转载 作者:行者123 更新时间:2023-11-27 23:26:09 26 4
gpt4 key购买 nike

<分区>

Possible Duplicate:
Order of evaluation of arguments using std::cout

#include<iostream>
#include<cstdio>
#include<cstring>

using namespace std;

static int series_num;

void setint(int num) {
series_num = num;
}

int ser() {
series_num = series_num + 23;
return series_num;
}

int main() {
setint(50);
cout << ser() << " " << ser();
getchar();
getchar();
return 0;
}

返回我 96 73

#include<iostream>
#include<cstdio>
#include<cstring>

using namespace std;

static int series_num;

void setint(int num) {
series_num = num;
}

int ser() {
series_num = series_num + 23;
return series_num;
}

int main() {
setint(50);
cout << ser();
cout << ser() << endl;
getchar();
getchar();
return 0;
}

返回 73 和 96

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com