C语言指针函数和函数指针

#include <stdio.h>
char *test();
void test1();
int main()
{
    /*********************************************
     *  指针函数:返回指针的函数(格式:返回数据类型 * 函数名(参数列表))     
* 函数指针:指向函数的指针 * * 定义指向函数的指针 * 格式: 函数返回类型 (*指针变量名)(参数列表) * double (*p)(double, char *, int); * 函数的指针赋值(函数名就是函数的地址): * int test(); * int (*p)() = test; * 或者 * int (*p)(); * p = test; * 调用函数: * test(); * (*p)(); * p(); * *********************************************
*/ char *c = test(); printf("指针函数 返回值%s ",c); void (*p)(); p = test1; test1(); p(); (*p)(); return 0; } //指针函数 char *test() { return "rose"; } void test1() { printf("指向函数的指针 "); }
指针函数 返回值rose
指向函数的指针
指向函数的指针
指向函数的指针
原文地址:https://www.cnblogs.com/heml/p/3530270.html