Papizo
JF-Expert Member
- Feb 24, 2008
- 4,944
- 1,431
- Thread starter
- #21
ndugu,
nafikiri unahitaji ku brush kidogo C. Kifupi tu ni kuwa unapopitisha argument kama array ktk C/C++ compiler inapitisha pointer to the first element. Kwa hiyo ni kama unapitisha array of int. Pass the variables by reference if you want to modify them directly. You have just opened the can of worms!
you need to re write again. Just a note, simple program like this needs no comment. Next time just put in a code and whenever someone does not understand a line will askCode:void addConst(int& x, int& y){ //modify the x and y and they will be modified out of the function also y=y+2; x=x+5; }
Thanx mkuu wala hamna tatizo kabisa naona next time nitafanya hivyo na nashukuru sana kwa mawazo yako yenye upeo zaidi!!