Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*______________________________________________________________________________________
- Function: getDuplicateValues
- Description: inputs one array, and outputs all repeated values into another array
- Arguments:
- arrayData1[] (I) - The array that inputs to function.
- arraySize1 - The size of the input array.
- arrayData2[] (O) - The array that outputs from function.
- Return Value: int
- ________________________________________________________________________________________*/
- int getDuplicateValues(int arrayData1[], int arrayData2[], int arraySize1) {
- int duplicateNum = 0;
- for (int x = 0; x < arraySize1; x++)
- {
- for (int z = x + 1; z < arraySize1; z++)
- {
- if (arrayData1[x] == arrayData1[z])
- {
- duplicateNum++;
- arrayData2[x] = arrayData1[z];
- break;
- }
- }
- }
- return duplicateNum;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement