4 ms·
Just to be clear, the rules of your swap challenge are that the arguments of the function have to be ints, not allowed to be int *, right? Also you say "two ob
by Myrmornis 10y ago
Just to be clear, the rules of your swap challenge are that the arguments of the function have to be ints, not allowed to be int *, right?
Also you say "two objects", but if the objects were compound, e.g. arrays, then I could write swap in C.
- lvh 10y agoYes. It's about swapping the arguments. With a struct or an array or a pointer or whatever, you're not swapping the arguments themselves; but the fact that there are so many things that do something slightly similar probably illustrates the limited utility of pass-by-reference.