Finding an array of unique values within a 2D array
Hi! I am new to C programming. I am trying to write a program that involves finding unique values in a 2D array and saving them in a separate array. The values in the 2D array are not sorted. Also, a value and its negative should be considered the same. For example, if the 2D array is
Code:
int array[][] = {1, 2, 3}
{-3, 4, 1}
{-1, 2, 5}
{5, 2, 6}
//The array of the unique values should be
unique[] = {1, 2, 3, 4, 5, 6}
Please explain the code that would carry out this function. Thank you!