#include <stdio.h>
#include <windows.h>
#include <stdlib.h>
DWORD WINAPI test_thread(LPVOID lpParam)
{
printf("thread whiiiii\n");
struct person
{
char *namee;
int agee;
};
struct person p = ((struct person)lpParam;
printf("%s\n",p.agee);
ExitThread(0);
}
int main()
{
struct person
{
char *name;
int age;
};
DWORD thread;
struct person p;
p.name = "John Smith";
p.age = 25;
printf("%s\n",p.name);
printf("%d\n",p.age);
CreateThread(NULL,0,test_thread,(LPVOID)&p,0,&thread);
while (1)
{
}
return 0;
}
Some reason it doesn't work, Can anyone help?