Reverse by copying the content to second array in reverse order and again copy to the initial array
| 312 | |
| 313 | //Reverse by copying the content to second array in reverse order and again copy to the initial array |
| 314 | void Rev1(struct array *arr) |
| 315 | { |
| 316 | int i,j; |
| 317 | int *B; |
| 318 | B=(int*)malloc(arr->size*sizeof(int)); |
| 319 | for(i=arr->length-1,j=0;i>=0,j<arr->size;i--,j++) |
| 320 | { |
| 321 | B[j]=arr->A[i]; |
| 322 | } |
| 323 | for(i=0;i<arr->size;i++) |
| 324 | { |
| 325 | arr->A[i]=B[i]; |
| 326 | } |
| 327 | } |
| 328 | |
| 329 | //Reverse the array bby swapping each equidistant element |
| 330 | void Rev2(struct array *arr) |