MCPcopy Create free account
hub / github.com/codemistic/Data-Structures-and-Algorithms / Rev1

Function Rev1

Arrays/31_Menu_for_Array.c:314–327  ·  view source on GitHub ↗

Reverse by copying the content to second array in reverse order and again copy to the initial array

Source from the content-addressed store, hash-verified

312
313//Reverse by copying the content to second array in reverse order and again copy to the initial array
314void 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
330void Rev2(struct array *arr)

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected