当前位置:网站首页>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
边栏推荐
- Butterfly theme beautification - Page frosted glass effect
- Package ‘*****‘ has no installation candidate
- Basic series of SHEL script (I) variables
- NSIS finds out whether the file exists and sets the installation path
- Ue5 hot update - remote server automatic download and version detection (simplehotupdate)
- Simple use of timeunit
- And let's play dynamic proxy (extreme depth version)
- What does soda ash do?
- Deepin, help ('command ') output saved to file
- Numpy——1.数组的创建
猜你喜欢

Numpy——1. Creation of array

CADD课程学习(5)-- 构建靶点已知的化合结构(ChemDraw)

Latex notes

Jenkins reported an error. Illegal character: '\ufeff'. Class, interface or enum are required

Don't confuse the use difference between series / and / *

Numpy——1.數組的創建

With the help of Navicat for MySQL software, the data of a database table in different or the same database link is copied to another database table

Daily Practice:Codeforces Round #794 (Div. 2)(A~D)

arcgis_ spatialjoin

Hdu1232 unimpeded project (and collection)
随机推荐
HDU1232 畅通工程(并查集)
Cygwin installation
With the help of Navicat for MySQL software, the data of a database table in different or the same database link is copied to another database table
Idea push project to code cloud
Machine learning Seaborn visualization
Apple modify system shortcut key
Shadowless cloud desktop - online computer
Tshydro tool
PIL's image tool image reduction and splicing.
Leetcode solution - number of islands
Butterfly theme beautification - Page frosted glass effect
Build your own random wallpaper API for free
Rough notes of C language (2) -- constants
Batch modify the txt file code to UTF-8 (notepad++)
Chapter 2: try to implement a simple bean container
From then on, I understand convolutional neural network (CNN)
Differences between pycharm and idle and process -- join() in vs Code
Day09 how to create packages import package naming conventions Alibaba Development Manual
R language learning notes 1
Numpy——1.数组的创建