void arrayRev(int arr[]){
int temp;
for(int i=0; i<=4; i++){
temp=arr[i];
arr[i]=arr[7-i];
arr[7-i]=temp;
}
}
int main() {
int arr[]={1,2,3,4,5,6,6,7};
for(int i=0; i<8; i++){
printf("value of element %d is %d\n",i,arr[i]);
}
arrayRev(arr);
printf("after reversing the array\n");
for(int i=0; i<8; i++){
printf("value of element %d is %d\n",i,arr[i]);
}
return 0;
}
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter