Skip to content

Instantly share code, notes, and snippets.

@donjajo
Last active April 12, 2019 21:03
Show Gist options
  • Select an option

  • Save donjajo/6d52c09717d250c338b8e425eed9bd8f to your computer and use it in GitHub Desktop.

Select an option

Save donjajo/6d52c09717d250c338b8e425eed9bd8f to your computer and use it in GitHub Desktop.
Finds the non-repeated number in an array
int *pop_array( int index, int a[], int length ) {
int *new_array = malloc( sizeof( int ) * length );
for( int i = 0; i < length; i++ ) {
if( i == index )
continue;
*(new_array+i) = a[i];
}
return new_array;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment