zoukankan      html  css  js  c++  java
  • void (*isr_handle_array[50])(void);求解这个申明怎么理解 啊??

    这是函数指针数组。一层一层向里面剥就好啦。

      是一个指向 返回值为void 参数也是void的指针数组。先看里面[50]知道是个数组,再向外看是一个函数指针,合起来就是函数指针数组。我写个源码,你就明白啦。

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    #include <stdio.h>
    //这是你问题中的函数指针数组
    void (*isr_handle_array[50])(void); 
    //这是两个返回值void 参数也是void的函数
    void hello(void) { printf ("hello ");}
    void world(void) { printf("world ");}
    int main()
    {
    //这里把hello 和world两个函数的地址保存到数组中
    isr_handle_array[0] = hello;
    isr_handle_array[1] = world;
    //这里就可以通过数组直接调用函数啦。
    isr_handle_array[0]();
    isr_handle_array[1]();
    return 0;
    }

    执行效果如下:

    hello world

  • 相关阅读:
    什么是云安全
    VMWare vForum 2013看点
    循环和数据的操作命令
    程序交互
    数据类型
    基础变量
    模块和包
    ['hello', 'sb']正则表达式
    os模块
    内置函数
  • 原文地址:https://www.cnblogs.com/yihujiu/p/5427131.html
Copyright © 2011-2022 走看看