Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <pthread.h>
- void* fun1(void *pv)
- {
- const char *str = pv;
- printf("%s\n", str);
- return NULL;
- }
- void* (*funptr)(void *);
- int main()
- {
- char msg1[10]="Hi";
- char msg2[10]="Hello";
- pthread_t pid1, pid2;
- funptr = fun1;
- pthread_create(&pid1, NULL, funptr, msg1);
- pthread_create(&pid2, NULL, funptr, msg2);
- pthread_join(pid1,NULL);
- pthread_join(pid2,NULL);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment