[問題] 函式指標再一問..
開發平台(Platform): (Ex: VC++, GCC, Linux, ...)
DEV C++
問題(Question):
函式指標+typedef的使用方式
有warning
錯誤結果(Wrong Output):
[Warning] initialization from incompatible pointer type
程式碼(Code):
#include<stdio.h>
#include<stdlib.h>
void func(int a,int b)
{
printf("%d\n%d",a,b);
}
int main()
{
typedef (*pfuntype)(int,int);
pfuntype newfunc = func;
newfunc(2,4);
system("pause");
return 0;
}
補充說明(Supplement):
之前有問過函式指標的用法了
大致上了解~
但加上typedef卻一直有警告產生...
問同學都沒下文= ="
請幫忙解惑一下Orz 感謝!
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.116.243.66
推
02/24 20:49, , 1F
02/24 20:49, 1F
→
02/24 20:54, , 2F
02/24 20:54, 2F
→
02/24 20:55, , 3F
02/24 20:55, 3F
→
02/25 11:43, , 4F
02/25 11:43, 4F
→
11/09 22:36, , 5F
11/09 22:36, 5F
C_and_CPP 近期熱門文章
PTT數位生活區 即時熱門文章