我有这个功能:
void update(int something, int nothing) {
something = something+4;
nothing = 3;
}
然后函数调用:
int something = 2;
int nothing = 2;
update(something, nothing);
在函数内部,有些东西是 6,没有东西是 3,但是因为我们不返回任何东西,所以值不会改变。
对于一个值,我可以使用函数的返回值,但现在我认为我必须使用指针,对吧?
我希望从函数返回的东西和无,所以我可以在函数调用后使用新值,我该怎么做?:)