多线程函数指针

#include <stdio.h>
#include <stdlib.h>
#include <process.h>
#include <Windows.h>

void run1(void *p)
{
    MessageBox(0, L"1", L"1", 0);
}

void run2(void *p)
{
    MessageBox(0, L"2", L"2", 0);
}

void run3(void *p)
{
    MessageBox(0, L"3", L"3", 0);
}

void main()
{

    /*_beginthread(run1, 0,  NULL);
    _beginthread(run2, 0, NULL);
    _beginthread(run3, 0, NULL);*/

    void(*pfun[3])(void *p) = { run1, run2, run3 };

    for (int i = 0; i < 3; i++)
    {
        _beginthread(pfun[i], 0, NULL);
    }

    system("pause");
}
原文地址:https://www.cnblogs.com/xiaochi/p/5170517.html