You are viewing a single comment's thread. Return to all comments →
#include<stdio.h> #include<stdlib.h> int main() { int n,*arr,i,temp; scanf("%d", &n); arr = (int *)malloc(n * sizeof(int)); for(i=0;i<n;i++) scanf("%d", (arr+i)); for(i=0;i<n/2;i++) { temp = *(arr+i); *(arr+i) = *(arr+(n-1)-i); *(arr+(n-1)-i) = temp; } for(i=0;i<n;i++) printf("%d ", *(arr+i)); free(arr); return 0; }
Seems like cookies are disabled on this browser, please enable them to open this website
Array Reversal
You are viewing a single comment's thread. Return to all comments →