# Answer to Question #5828 in C++ for Kewal

Question #5828

Write a function that takes a double array name and an array size as arguments and that swaps the first and last value in that array.

Expert's answer

void swap(double arr[], int n){

& double a;

& a = arr[0];

& arr[0] = arr[n-1];

& arr[n-1] = a;

}

& double a;

& a = arr[0];

& arr[0] = arr[n-1];

& arr[n-1] = a;

}

## Comments

## Leave a comment