Write a program to identify a duplicate value in vector ?

Questions by ghousia razvi

Showing Answers 1 - 3 of 3 Answers

Code
  1.  

  2. void rmdup(int *array, int length)

  3. {

  4.     int *current, *end = array + length - 1;

  5.  

  6.     for (current = array + 1; array < end; array++, current = array + 1) {

  7.         while (current < end) {

  8.             if (*current == *array) {

  9.                 *current = *end--;

  10.             } else {

  11.                 current++;

  12.             }

  13.         }

  14.     }

  15. }

  16.  

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions