1//write a program to print all unique elements in an array in c
2
3#include <stdio.h>
4
5int main(int argc, char const *argv[])
6{
7 int arr[] = {4, 256, 2, 256, 4, 3, 3, 5}, seen;
8 int arr_length = sizeof(arr) / sizeof(int);
9
10 for (int i = 0; i < arr_length; i++)
11 {
12
13 seen = 0;
14 for (int j = i + 1; j < arr_length; j++)
15 {
16 if (arr[i] == arr[j])
17 {
18 seen = 1;
19 }
20 }
21 if (seen == 0)
22 {
23 printf("%d ", arr[i]);
24 }
25 }
26
27 return 0;
28}
29