zoukankan      html  css  js  c++  java
  • 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
    指向函数的指针
    指向函数的指针
    指向函数的指针
  • 相关阅读:
    Python学习-day10
    python学习-day9
    Python学习-day8
    Python学习-day7
    Python学习-day6
    Django2
    Django讲解
    JQuery讲解
    前端Day2
    前端Day1
  • 原文地址:https://www.cnblogs.com/heml/p/3530270.html
Copyright © 2011-2022 走看看