Write a function to reverse an integer array {9, 2, 3, 5, 7}.
MediumProblem Statement
Write a function to reverse an integer array {9, 2, 3, 5, 7}.
Sample Input
9 2 3 5 7
Sample Output
7 5 3 2 9
Limits
Time: 2s · Memory: 256 MB
Code Editor
00:00
#include <stdio.h>
void reverseArray(int arr[], int n) {
// Your code here
}
int main() {
int arr[] = {9, 2, 3, 5, 7};
reverseArray(arr, 5);
for (int i = 0; i < 5; i++) {
printf("%d ", arr[i]);
}
printf("\n");
return 0;
}
Input
9 2 3 5 7
Expected Output
7 5 3 2 9