I am reading some book and I have encountered a piece of code that wasn't explained in the book, but has some part which is very confusing to me, bold part, and I want to know what is it about.
void Set::intersection(const Set& s1, const Set& s2)
{
Set s;
s.arrayA = new double[ s1.sizeA<s2.sizeA ? s1.sizeA : s2.sizeA];
int i, j, k;
while(i < s1.sizeA && j < s2.sizeA)
if(s1.arrayA[i] < s2.arrayA[j])
i++;
else if (s1.arrayA[i] > s2.arrayA[j])
j++;
else
s.arrayA[k++] = s1.arrayA[j++,i++]; // question is about this line
s.sizeA= k;
deleteA();
copyA(s);
}
What does it do, and why is there two parameters inside the [] brackets? Thanks in advance.
k, but does not initialize it.i,jandkare still not initialised with any values before they are used!