I am trying to create dynamic number of thread.....
#include<stdio.h>
#include<pthread.h>
void* thread_function(void)
{
printf("hello");
}
int main(int argc,char *argv[])
{
int noOfThread= atoi(argv[1]);
pthread_t thread_id[noOfThread];
int i;
int status;
for(i=0;i<noOfThread;i++)
{
pthread_create (&thread_id[i], NULL , &thread_function, NULL);
}
for(i=0;i<noOfThread;i++)
pthread_join(thread_id[i],NULL);
}
3 errors:
- implicit declaration of function atoi....
- passing arguement 3 of 'pthread_create' from incompatible pointer type
- expected 'void * (*)(void *)' but arguement is of typr'void * (*) (void)'......