Suppose you want to add some huge numbers
int add(int &a, int b){
return a = a+b;
}
int add_(int a, int b){
int c = a+b;
return c;
}
This is what I have in my mind. I was actually thinking about adding two vectors then I generalized it to numbers. If you want to use the add
style, what will you do if you need the original value of a
? And if you want to use the add_
style, isn't it memory waste if you have to add, subtract and multiply a lot of large numbers?
What is the standard way of doing this?