I mean both results should be true as they add all elements from vector a and b, the difference as you see is that the second option doesn't show the 2 last different elements ( 6 and 7)
what does it mean to add two "vectors" that have different lengths?
This is not allowed in 'math vectors', right?
you can set both to zero initially:
int a[1000] = {0};
and then add past the end:
int end = max(a_length, b_length);
for(int i = 0; i < end; i++)
c[i] = a[i]+b[i]; //whichever one runs dry is zeros, so you just get 0+other
or you could use min, and only add them out as far as both are valid, and skip/ignore/ the extras on one or the other. This would cover both of your examples, I believe.
side note, try to avoid stuff like this:
if( i< ?) c[i]=a[i]+b[i];
else c[i] = ?
it is going to be inefficient. find a way, if you can, to have the logic ingrained so it just does the work without checking anything if possible (my suggestions would both do this, but I dunno if they are what YOU wanted to do).
So, my purpose is to add 2 arrays with different nr. of elements in it.
Max, you don't appear to get the point. It is irrelevant whether they are "vectors" or "arrays" or any other sort of container with multiple elements. You need to define, mathematically, how they should be added if they have different numbers of elements, because there is no obvious preferred way of doing it. And as for division ...
a[10] and b[12], aren't they possible to be added? why not?
Because, as both @Againtry and I have said, there is no defined way of doing so. You have identified two possible choices - neither of which make any sense from a pure maths (vector spaces) point of view. A third way would, in fact, be simply to append them, making an array of 22 elements. None of those methods satisfy the usual rules of "addition"; (look up "commutative groups").
So, there you have it. Unless you define what you particularly want to do ... there is no a priori reason for choosing any particular one of those three.
I suspect this is an XY problem. Perhaps you can say what you are going to do with your new maths when you have got it.