Generation

generate functionSun, 30 Jul 2023

function to store similar occurrences with repetition in an array in C

int storeSimilar(int a[], int n, int x) { int i, j = 0; for (i=0; i<n; i++) if (x == a[i]) a[j++] = x; return j; }

Questions about programming?Chat with your personal AI assistant