[C] Basic multi-thread programming help
I want to create 2 threads, one does the max and one gives the average of a list of numbers entered in the command line.
I just made the first thread, which is to print out the min. number, but I have the following errors when compiling:
void * thread1(int length, int array )
int ii = 0;
int smallest_value = INT_MAX;
for (; ii < length; ++ii)
if (array[ii] < smallest_value)
smallest_value = array[ii];
printf("smallest is: %d\n", smallest_value);
void * thread2()
printf("How many numbers?: ");
printf("Enter the list of numbers: ");
How should I go on and fix the seg. fault?
How many numbers?: 3
Enter the list of numbers: 1