c语言多线程举例

程序实现功能:实现弹出多个消息框

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

#include<Windows.h>
#include<process.h>
void (void *p)
{
MessageBoxA(0, "###", "//", 0);
}
void main()
{
_beginthread(msg, 0, NULL);

//每个线程都有自己专属的栈(stack)
_beginthread(msg, 0, NULL);
_beginthread(msg, 0, NULL);
_beginthread(msg, 0, NULL);
getchar();
}