sách gpt4 ăn đã đi

c - 将函数指针分配给函数指针数组

In lại 作者:太空狗 更新时间:2023-10-29 15:31:24 25 4
mua khóa gpt4 giày nike

<分区>

在下面的代码中,我试图将函数指针分配给函数指针数组。我收到错误消息

error: initializer element is not constant and then a note says near initialization for 'stateTable2[1]'.

hiện hữu chủ yếu 中,我尝试将函数指针分配给另一个函数指针,但没有问题。

void function1 (void) // Function definition
{

}

void function2 (void) // Function definition
{

}

void (*fptr)(void) = function2;

void (*stateTable2[]) (void) = {function1,fptr};

int chính()
{
void(*fp)(void) = fptr;
trả về 0;
}

25 4 0
Chứng chỉ ICP Bắc Kinh số 000000
Hợp tác quảng cáo: 1813099741@qq.com 6ren.com
Xem sitemap của VNExpress