zoukankan
html css js c++ java
函数指针
1、常见的用法
#include <stdio.h> typedef int (*PFUN)(int, int); // PFUN 是函数指针类型 int fun(int a, int b) { return a + b; } int main(void) { PFUN pf = fun; // 或 PFUN pf = &fun; printf("%d\n", pf(1, 2)); printf("%d\n", (*pf)(1, 2)); return 0; }
2、第二种用法
#include <stdio.h> typedef int FUN(int, int); // FUN 是函数类型 int fun(int a, int b) { return a + b; } int main(void) { FUN *pf = fun; // 或 FUN *pf = &fun; printf("%d\n", pf(1, 2)); printf("%d\n", (*pf)(1, 2)); return 0; }
3、关于函数指针的类型
#include <stdio.h> typedef int FUN(int, int); int fun(int a, int b) { return a + b; } int main(void) { // (int (*)(int, int)) pf; // 错误,不能这样定义变量 FUN *pf; pf = (int (*)(int, int))1; // 强制类型转换,可以 pf = fun; printf("%d\n", pf(1, 2)); printf("%d\n", (*pf)(1, 2)); return 0; }
查看全文
相关阅读:
SSM整合初级 简单的增删改查
初始SpringMVC
初始Spring MVC
Web Service简介
Quartz框架 实现任务调度
搭建james邮件服务器
使用Jdbc Template的基本操作步骤
spring AOP四种实现方式
Struts2数据校验
Struts2 与Servlet API解耦,耦合的访问方式
原文地址:https://www.cnblogs.com/jjtx/p/2533492.html
最新文章
Manjaro 安装手记
tarjan复习笔记
qbxt Day3 on 2019-8-18
qbxt Day2 on 19-7-25
题解 SP4033 【PHONELST
网络流学习笔记2
题解 P1033 【自由落体】
题解 P1017 【进制转换】
线段树数据结构详解
ST算法详解
热门文章
E-Business Suite 12.2 Detailed Steps To Change The R12.2 Default Port To 80 (Doc ID 2072420.1)
监控SQL性能的工具dbms_sqltune使用介绍
SQL调优工具包DBMS_SQLTUNE的使用方法
tmpwatch命令清除旧文件
EBS 并发管理器问题之重启与修复
nfs安装
How to Change Applications Passwords Using Applications Schema Password Change Utility (FNDCPASS or AFPASSWD)? (Doc ID 437260.1)
DataGuard主备归档存在gap的处理办法
https://docs.oracle.com/cd/E18727_01/doc.121/e13620/T450006T314714.htm
使用LogMiner查看归档日志
Copyright © 2011-2022 走看看