I have an array that contains pointers. How can I swap two pointers - say array[1] and array[4] - correctly?
You need a temporary variable:
void*temp = array[4];
array[4]=array[1];
array[1] = temp;
Edit Fixed first line.
void* temp = array[1];
array[1] = array[4];
array[4] = temp;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With