From fb5f62cbaa495575ccfba85ee174a3b1ee516711 Mon Sep 17 00:00:00 2001 From: TusharKrSoniTKS <90370349+TusharKrSoniTKS@users.noreply.github.com> Date: Thu, 19 May 2022 11:44:14 +0530 Subject: [PATCH] Create removing_duplicates_from_array.c Adding C file for removing duplicates form a Sorted array --- .../C/arrays/removing_duplicates_from_array.c | 58 +++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 algorithms/C/arrays/removing_duplicates_from_array.c diff --git a/algorithms/C/arrays/removing_duplicates_from_array.c b/algorithms/C/arrays/removing_duplicates_from_array.c new file mode 100644 index 00000000..4c9300bc --- /dev/null +++ b/algorithms/C/arrays/removing_duplicates_from_array.c @@ -0,0 +1,58 @@ +//This code removes duplicates from a sorted array +//For example we enter the array -:5 6 6 7 8 8 +//The the output will be -: 5 6 7 8 + + +#include + +void removeDuplicates(int arr[], int size){ + + int newsize = size;//keeping track of array size + + for(int i=0,j=i+1;j