Print Unique Elements Of An Array | C Programming Example

preview_player
Показать описание
Комментарии
Автор

Great video! One question: in order to save CPU load, could the second for starts with "int j = i", instead of "int j = 0", since the previous comparisons were already done? Thanks!

fabbarrs
Автор

Thank You so much!
Your teaching skill and solving skill is very unique from others!
Big fan!

hafizsakib
Автор

This video was very useful and the explanation is very competent, please tell me how to calculate the number of unique elements based on this code

сергеймихайлов-чщ
Автор

Really helpful. Great explanation. Thanks!

butterymcbacktail
Автор

can we write the unique elements program using pointers, if so kindly explain

AdditionalControllerExaminatio
Автор

Dear,
You have assigned matchFound = false;
so doesn't !matchfound means true?
if it is true why the program entering into 2nd condition?
because we are printing unique elements

hafizsakib
Автор

How we find that this number will be unique please help me

omvanjani
Автор

void uniqeElements(int arr[], int size)
{
int i, j;
for (i = 0; i < size; i++)
{
bool matchFound = false;

for (j = (i + 1); j < size; j++)

{
if (arr[i] == arr[j])
{
matchFound = true;
}
}

if (!matchFound)
{
printf("%d ", arr[i]);
}
}
}



Please tell me why this function is not printing the right output?

hafizsakib