Question: My current C program is as followes: #include int readElementsToArray(int array[]) //decide how many inputs will be put into the array { int n; printf(enter

My current C program is as followes:

#include

int readElementsToArray(int array[])

//decide how many inputs will be put into the array { int n; printf("enter elements into the array: "); for(int i = 0; i++;) scanf("%d",&array[i]); return n; }

void printArray(int array[], int n) { for(int i=0; i

int EfficientBubbleSort(int A[], int n) { int exchange, i, j, temp; for (i = 0; i

int MergeArrays(int A[], int B[], int C[], int n1, int n2) { for(int i = 0; i

int main() { int A[20], B[20], C[40], Asize, Bsize, Csize; printf(" Enter elements to first array: "); Asize = readElementsToArray(A); printf(" Enter elements to second array: "); Bsize = readElementsToArray(B); printf(" First array elements in their original order:"); printArray(A, Asize) ; printf(" Second array elements in their original order:"); printArray(B, Bsize) ; EfficientBubbleSort(A, Asize); EfficientBubbleSort(B, Bsize); printf(" First array elements in their sorted order:"); printArray(A, Asize) ; printf(" Second array elements in their sorted order:"); printArray(B,Bsize) ; Csize = MergeArrays(A, B, C, Asize, Bsize); EfficientBubbleSort(C, Csize) ; printf("The new merged array in their sorted order:"); printArray(C, Csize) ;

}

it is a program designed to sort each vector and then merge and sort again,it works however i need my code to not have to ask for the number of elements in each vector, how would i modify my code to do so?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!