arrayReverse
Fri Jun 10 2022 05:12:45 GMT+0000 (Coordinated Universal Time)
Saved by
@KanishqJ8
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;
}
content_copyCOPY
Comments