@igorrr37
1820 / 1438 / 215
Регистрация: 21.12.2010
Сообщений: 2,348
|
24.02.2011, 21:26
|
|
аргументы пакуются в указатель на void
C | 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
| #include<stdio.h>
#include<windows.h>
#include<process.h>
HANDLE e;
unsigned __stdcall one(void* p){
int *pint=(int*)p, a, b, cou=10;
a=*pint, b=*(pint+1);
while(cou--){
printf("%d ", a+b);
}
SetEvent(e);
return 0;
}
int main(){
int mas[]={1, 2};
e=CreateEvent(NULL, FALSE, FALSE, NULL);
_beginthreadex(NULL, 0, &one, (void*)mas, 0, NULL);
WaitForSingleObject(e, INFINITE);
return 0;
} |
|
2
|