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
parent
368ec2e1db
commit
ac5a7fa781
|
@ -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');
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue