Update shuffle_array.c

Since you are using the array pointer, just increment it in the loop and access the value in the address.
pull/843/head
Francis Karuri 2022-09-15 16:26:15 +03:00 committed by GitHub
parent 368ec2e1db
commit ac5a7fa781
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -33,8 +33,9 @@ void shuffle(int *array, int size) // Randomly shuffles given array
void print_array(int *array, int size) // Printing array
{
for (int i = 0; i < size; i++) {
printf("%d ", array[i]);
//PERF: Since you are using the array pointer, just increment it in the loop.
for (int i = 0; i < size; i++, array++) {
printf("%d ", *array);
}
putchar('\n');
}