#include<stdio.h>
#include<stdlib.h>
#include<string.h> int Funcadd(int a, int b)
{
return a + b;
}
int Funcplus(int a, int b)
{
return a - b;
}
int Funcmul(int a, int b)
{
return a * b;
}
int Funcdiv(int a, int b)
{
return a / b;
} typedef int(*MyTypeFunc)(int a, int b);
int mainop(MyTypeFunc mypointer)
{
int temp = mypointer(5,6);
return temp; } int mainop2(int(*MyPointFunc)(int a, int b))
{
int temp=MyPointFunc(4, 3);
return temp;
} int main()
{
int temp1=mainop(Funcadd);
printf("%d\n",temp1); temp1 = mainop2(Funcadd);
printf("%d\n", temp1); temp1 = mainop2(Funcplus);
printf("%d\n", temp1); temp1 = mainop2(Funcmul);
printf("%d\n", temp1); temp1 = mainop2(Funcdiv);
printf("%d\n", temp1); system("pause");
}

  

函数指针做函数参数,其中有typedef的相关,感觉这是构成大河的小溪的更多相关文章

  1. Day8 函数指针做函数参数

    课堂笔记 课程回顾         多态 virtual关键字 纯虚函数 virtual func() = 0;         提前布局vptr指针 面向接口编程 延迟绑定 多态的析构函数的虚函数. ...

  2. go语言基础之数组指针做函数参数

    1.数组指针做函数参数 示例: package main //必须有个main包 import "fmt" //p指向实现数组a,它是指向数组,它是数组指针 //*p代表指针所指向 ...

  3. go语言基础之指针做函数参数用地址传递

    1.指针做函数参数 示例: package main //必须有个main包 import "fmt" func swap(p1, p2 *int) { *p1, *p2 = *p ...

  4. go语言基础之指针做函数参数

    1.指针做函数参数 示例: package main //必须有个main包 import "fmt" func swap(a, b int) { a, b = b, a fmt. ...

  5. typedef void(*Fun) (void)是什么意思 函数指针(回调函数) 和函数对象总结

    https://blog.csdn.net/FreeApe/article/details/49124043 bool (*pf)(const string &,const string &a ...

  6. Delphi 函数指针(函数可以当参数)

    首先学习: 指向非对象(一般的)函数/过程的函数指针 Pascal 中的过程类型与C语言中的函数指针相似,为了统一说法,以下称函数指针.函数指针的声明只需要参数列表:如果是函数,再加个返回值.例如声明 ...

  7. C++中的函数指针和函数对象总结

    篇一.函数指针函数指针:是指向函数的指针变量,在C编译时,每一个函数都有一个入口地址,那么这个指向这个函数的函数指针便指向这个地址.函数指针的用途是很大的,主要有两个作用:用作调用函数和做函数的参数. ...

  8. [C/C++]如何解读返回函数指针的函数声明

    今天在看<深入理解C++11>的时候,看到一段有意思的代码: int (*(*pf())())() { return nullptr; } 我立刻就懵了——从来没有见过这样的函数声明.那么 ...

  9. C/C++回调方式系列之一 函数指针和函数回调模式

    一.函数指针 1. 函数的定义 return_type function_name(parameter list) { function_body } return_type: 返回值,函数一定有返回 ...

随机推荐

  1. BZOJ2306: [Ctsc2011]幸福路径

    Description 有向图 G有n个顶点 1, 2, -, n,点i 的权值为 w(i).现在有一只蚂蚁,从 给定的起点 v0出发,沿着图 G 的边爬行.开始时,它的体力为 1.每爬过一条 边,它 ...

  2. 【Entity framework】Code First Approach

    开篇之前感谢 china_fucan的文章给我的帮助,下面的评论也解决了很多问题同样给予感谢. code first 项目中的ORM框架如果采用的是EF,那么可能会采用code first的方式去使用 ...

  3. js判断数字、整数、字符串、布尔,特殊方法

    整数: function isInteger(obj) { return Math.floor(obj) === obj } isInteger(3) // true isInteger(3.3) / ...

  4. ADO.NET DBHelper

    using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Da ...

  5. 在用node安装某个全局模块的时候,没有权限修改node_modules

    一.问题 今天在安装公司内部的一个npm模块的时候,发现报错了⬇ 第一行错误: deprecated graceful-fs@1.2.3: please upgrade to graceful-fs ...

  6. 理解 Redis(2) - 手把手教你理清 Redis 安装全过程

    Redis 官网 https://redis.io/ 之前学习 Redis 学了好多次, 下载安装也都按照教程或官网文档弄过, 但是对于安装过程一直有点迷糊, 感觉稀里糊涂地就好了, 就可以用了. 这 ...

  7. _killerstreak

    `count`连杀或终结连杀的数量(最大支持10个) `announceFlag` 0-不广播1-只广播连杀消息2-只广播终结连杀消息3-广播连杀与终结连杀消息 `rewId` 连杀奖励模板Id,对应 ...

  8. vs 2013 编译cocos2d-x-3.9

    下载地址:链接: https://pan.baidu.com/s/1IkQsMU6NoERAAQLcCUMcXQ 提取码: p1pb 下载完成后,解压 进入build 目录 使用vs 2013 打开工 ...

  9. 【C#】侦听文件系统更改通知 FileSystemWatcher 类

    using System; using System.IO; using System.Security.Permissions; public class Watcher { public stat ...

  10. ORA-03113: end-of-file on communication channel(归档满处理方法)

    归档放在flash_recovery目录,由于归档占满了闪回目录,数据库启动报错ORA-03113: end-of-file on communication channel tail -1200f ...