I am trying to code for the following but in vain. can someone help?
Create a thread that continuously loops, prompting the user to input an integer.The second thread sleeps for ten seconds, and then displays: the maximum value input so far; . It then goes back to sleep and repeats.
I am highly confused and stuck. Can someone help
This is the code so far
pthread_create(&thread1, NULL, &inputfunction, NULL);
        pthread_create(&thread2,NULL, &inputfunction, NULL);
        pthread_join(thread1,NULL);
       // pthread_join(thread2,NULL);
//        pthread_mutex_init(&array_lock, NULL);
        return 0;
}
void *inputfunction()
{
        //int *values= ptr_value;
        int i;
        int arr[5];
        printf("Input values:");
        for (i=0;i<5;i++)
        scanf("%d",&arr[i]);
        sleep(10);
        int max=0;
        for (i=0;i<5;i++)
                {
                        if (arr[i]>max)
                                max=arr[i];
                }
        printf("max=",max);
        return NULL;
}
 
     
     
     
    