Question: C Programming Given an array of N integers, use realloc to increase the size of the integer array by a factor of two, and then
C Programming
Given an array of N integers, use realloc to increase the size of the integer array by a factor of two, and then store the original N integers in the array. At this time, the entire array is stored in ascending order. Repeat the above operation three times and print out each step.
Input: The integer N is given on the first line. On the second line, N integers are given. Output: Output 2 * N lines on the first line, 4 * N lines on the second line, and 8 * N lines on the third line. Constraint Can not declare static array Can not declare global variable Void double_double (int ** a, int * size); This function doubles array a with size size, which is populated by call by reference, and stores the doubled value in the empty space of a. At this time, it is stored in ascending order

Please fix my code:
#include
void sort(int *a, int n)/*{{{*/ { int i, j, temp; for (i = 0; i a[j]) { temp = a[i]; a[i] = a[j]; a[j] = temp; } } } } /*}}}*/ void double_double(int *a, int n)/*{{{*/ { int i, new; new = n / 2; a = (int *)realloc(a, n * sizeof(int)); for (i = new; i
int main()/*{{{*/ { int *a, n, i, j, no; printf("How many Numbers? "); scanf("%d", &n);
a = (int *)malloc(sizeof(int));
for (i = 0; i
for (j = 1; j
return 0; } /*}}}*/
gr120160213@cspro:/exer_tests ./a.out 3 12 3 1 2 2 3 4 6 12 22 34446 68 12 1 2 22 2 344444466688 8 8 12 12 12 16 24 gr120160213@cspro:~/exer_test$ ./a.out 1 4 4 8 4 8 8 16 4 888 16 16 16 32 gr 120160213@cspro:~/exer_test$ ./a.out 5432 12 2 3445 6 8 10 1 2 2 2 34444566 8 8 8 10 10 12 16 20 122223 4 4444445666888888810 10 10 12 12 12 16 16 16 16 20 20 20 24 32 40
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
