- 论坛徽章:
- 0
|
#include <stdio.h>
#include <pthread.h>
#define NUM 6
int main()
{
void print_msg(void* m);
pthread_t t1,t2;
pthread_create(&t1,NULL,print_msg,(void *)"hello,");
pthread_create(&t2,NULL,print_msg,(void *)"whorld!\n");
pthread_join(t1,NULL);
pthread_join(t2,NULL);
}
void print_msg(void* m)
{
char *cp=(char*)m;
int i;
for(i=0;i<NUM;i++)
{
printf("%s",m);
fflush(stdout);
sleep(1);
}
}
这个程序为什么在我自己的机器上老是运行不起来 总是有警告 并且运行之后也没有输出
以下是报错 恳请大大们帮忙看看 究竟是什么原因老是运行不起来
cc: "99.c", line 9: warning 604: Pointers are not assignment-compatible.
cc: "99.c", line 9: warning 563: Argument #3 is not the correct type.
cc: "99.c", line 10: warning 604: Pointers are not assignment-compatible.
cc: "99.c", line 10: warning 563: Argument #3 is not the correct type.
谢谢了 |
|