返回指针的函数

/*
1. 看懂语法
2. 定义指向函数的指针:
    double(*p)(double,char *,int);
    p = haha;
    or
    double (*p)(double,char *,int)=haha;
3.如何间接调用函数
    1. p(19.7,"jack",10);
    2. (*p)(19.7,"jack",10); 


*/ 
#include <stdio.h>
int main(int argc, char *argv[])

void test(){
    
    printf("利用指针调用函数
");
    
}
{
    // (*p)是固定写法,代表指针比那辆p将来肯定指向参数函数 
    //左边的void:指针 变量p指向的函数没有返回值
    //右边的():指针变量p指向的函数没有形参; 
    void (*p)();
    /////////////////////////////////////// 
    p = test;//指针变量p指向了test函数
    
    (*p)();//利用指针变量间接调用函数
    test();//直接调用函数
    p();//这种方法=test(),因为p=test了 
    
    return 0;
}
原文地址:https://www.cnblogs.com/xiaomi5320/p/4330601.html