level 8
class cp{public:void real(long);}; void cp::real(long rea){rea++;cout<<"fvck";} int main(){com c;int i=1;c.real(i);cout<<i;return 0;}
2013年04月29日 02点04分
1
level 1
不知道你是不是想改变变量i的值。如果是,你方法中传进去的形参是按值传递,是传进去的实参的拷贝。加一操作是rea变量,出了函数,就出了rea的作用域,而变量i没有影响,所以还是1。如果想改变i的值,形参用引用。
2013年04月29日 04点04分
3