Delete Repeated Numbers Array Sorting in C Program

C Program for Sorting an Array Containing Unique Array Values

The C Program will delete repeated values or numbers in an array and produce a resulting array which containing only unique records. This is the type of array sorting gives the length of the array with no-repeated numbers

C program for How to Delete Duplicate Values in an Array

#include<stdio.h>
int deleteRepeatedNumbers(int list[], int size)
{
if(size < 1)
return 0;
int newLength = 1;
for(int i = 1; i < size; i++)
if(list[i-1] != list[i])
list[newLength++] = list[i];
return newLength;
}

int main()
{
int sortedArray[] = {1, 1, 1, 1, 2, 3, 4, 4, 5, 5, 6, 6 ,6 ,6, 11};
printf("%d", deleteRepeatedNumbers(sortedArray, 15));
return 0;
}


Related Topic Bubble Sort in C Program
Merge Sort Java Program Source Code
Java String Replace Regex
Java Find Average Value in Array
PHP Program to Find Number of Users Online

nScraps.com © 2011   Privacy Policy  Terms of Service  Feedback