首页 > 编程语言 > 详细

这就是C 语言中的指针函数写法。

时间:2021-09-05 20:43:55      阅读:32      评论:0      收藏:0      [点我收藏+]
#include <stdio.h>
#define uint8           unsigned char
#define uint16          unsigned short
#define uint32          unsigned int

uint8 get_device_type_flash() { 
    printf("--------------- run ------------------ \n");
    return 100;
}
uint8 get_flash_1byte(void * funtype){
    uint8 (* fun)() = funtype;
    uint8 num = fun();
    return num;
}
uint8 get_device_type() { return get_flash_1byte(get_device_type_flash); }

int main(int argc, char const *argv[])
{
    uint8 num = get_device_type();
    printf("res: %d \n", num);
    return 0;
}

  

这就是C 语言中的指针函数写法。

原文:https://www.cnblogs.com/ianzelog/p/15227612.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!