This question already has an answer here:
- Sequence-zip function for c++11? 13 answers
I would like to zip two arrays in C++ (as in Python) using a standard library function, so is there any equivalent for Python's built-in function zip()?
This question already has an answer here:
I would like to zip two arrays in C++ (as in Python) using a standard library function, so is there any equivalent for Python's built-in function zip()?
int **zip(int *arr1, int *arr2, int length)
{
int **ret = new int*[length];
for(int i = 0; i<length; i++)
{
ret[i] = new int[2];
ret[i][0] = arr1[i];
ret[i][1] = arr2[i];
}
return ret;
}