当前位置:网站首页>Function and usage of function pointer
Function and usage of function pointer
2022-07-05 07:38:00 【Code boy】
1、 Function pointer function :
The advantage of using function pointers is that , Multiple modules that realize the same function can be identified together , This makes it easier
Easy for later maintenance , The system structure is clearer . Or summed up as : Easy to layer design 、 It's good for system abstraction 、 Reduce coupling and separate the interface from the implementation .
#include <iostream>
using namespace std;
int arr(int a, int b) {
return 0; }
int brr(int a, int b) {
return 1; }
int main()
{
int (*frr)(int, int);// Here is the function pointer
frr = arr;// It can point to arr
cout << frr(1, 2) << endl;
frr = brr; You can also point to brr, Just change the object pointed to , You can operate different functions
cout << frr(1, 2) << endl;
return 0;
}
C/C++ Function pointer Usage Summary :https://www.cnblogs.com/lvchaoshun/p/7806248.html
边栏推荐
- Ugnx12.0 initialization crash, initialization error (-15)
- Rough notes of C language (2) -- constants
- 并查集理论讲解和代码实现
- 使用go语言读取txt文件写入excel中
- Typescript get timestamp
- Pit record of Chmod 2 options in deepin
- I can't stand the common annotations of idea anymore
- From then on, I understand convolutional neural network (CNN)
- Package ‘*****‘ has no installation candidate
- 2022 PMP project management examination agile knowledge points (7)
猜你喜欢
Graduation thesis project local deployment practice
I implement queue with C I
Numpy——1. Creation of array
Jenkins reported an error. Illegal character: '\ufeff'. Class, interface or enum are required
Tshydro tool
Don't confuse the use difference between series / and / *
Nombre - 1. Création de tableaux
Basic series of SHEL script (III) for while loop
Latex notes
Rough notes of C language (1)
随机推荐
Professional knowledge of public security -- teacher bilitong
Charles- unable to grab bags and surf the Internet
Daily Practice:Codeforces Round #794 (Div. 2)(A~D)
HDU1231 最大连续子序列(分治or动规or双指针)
Basic knowledge of public security -- FB
Numpy——1.数组的创建
Batch convert txt to excel format
repo. conda. An example of COM path error
Basic series of SHEL script (III) for while loop
P3D gauge size problem
Line test -- data analysis -- FB -- teacher Gao Zhao
list. files: List the Files in a Directory/Folder
Hdu1231 maximum continuous subsequence (divide and conquer or dynamic gauge or double pointer)
Anaconda pyhton multi version switching
Simple operation of running water lamp (keil5)
Logistic regression: the most basic neural network
Apple modify system shortcut key
借助 Navicat for MySQL 软件 把 不同或者相同数据库链接中的某数据库表数据 复制到 另一个数据库表中
How to deal with excessive memory occupation of idea and Google browser
Thunderbird tutorial \ easy to use mail client