Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

C Programming help: How do I fix this expression? #include(stdio.h> #include mat

ID: 3714326 • Letter: C

Question

C Programming help:

How do I fix this expression?

#include(stdio.h> #include math.h> #include #include /function prototypes void fil1(int arr[], int SIZE); void display(int arr[], int SIZE); void insertionSort(int arr[l], int SIZE); int main 4 6 7 8 9 12 13 const int SIZE-100 int randarr[SIZE]; fill(randarr, SIZE); printf("Before sorting "); 15 16 17 display (randarr, SIZE); insertionSort(randarr,SIZE); printf("After sortingln" display (randarr,SIZE); 21 getch) return e; 23 void fil1(int arr[], int SIZE) 25 26 27 28 srand (time_t(e)) for(int 1-0;¡SIZE;i++) arr [1]-rand( )%100; 31 32 /Display elements on the console void display(int arr[], int SIZE) for(int 1-0;i

Explanation / Answer

you should use srand(time(0)); instead of srand(time_t(0)) and this would remove the error as the standard practice is to use the result of a call to srand(time(0)) as a seed,time() returns a time_t value which may vary everytime and the pseudorandom number vary for every program call.