当前位置:网站首页>C language pointer to function
C language pointer to function
2022-06-29 06:33:00 【The universe is hidden in the book】
The main points of : Define a function in a program , The compiler will convert the source code of the function into executable code and allocate the corresponding storage space . This storage space will have an address , The function name is the starting address . You can use a pointer to a function type , You can call a function by pointing to its starting address
Its definition format is as follows :
float (*p)(float 1,float 2,…float n)
At this time P A pointer is a pointer that has n Parameters , The return value is float Function of type .
#include <stdio.h>
int main()
{
float Max(float a ,float b);
float a=2.1 ,b=3.3;
float (*p)(float,float);
p=Max; // Pointer to Max Function entry
// The entry of a function is also an address in physical storage , The function name represents its
// Initial address
printf(" The maximum number is :%f",(*p)(a,b));
}
float Max(float a ,float b)
{
return a>b?a:b;
}
Running results : The maximum number is :3.300000
边栏推荐
- Two houses with different colors and the farthest distance
- Call the computer calculator and use it to convert several base numbers
- Can redis implement hot standby?
- Installing modules in pycharm
- Hyperledger Fabric 2. X custom smart contract
- Can I cast int to a variable of type byte? What happens if the value is larger than the range of byte type?
- Analysis comp122 the Caesar cipher
- Use of sed in shell script
- 百度小程序自动提交搜索
- Venn diagram proportional and color shading with semi transparency
猜你喜欢

Call the computer calculator and use it to convert several base numbers

百度小程序自动提交搜索
![ASP. Net core 6 framework unveiling example demonstration [03]:dapr initial experience](/img/fd/4c24e10fc91a7ce7e709a0874ba675.jpg)
ASP. Net core 6 framework unveiling example demonstration [03]:dapr initial experience

分享 10 个 JS Promise 相关的面试题

Creation of Arduino uno development environment

Rich material libraries make modeling easy and efficient for developers
![ASP. Net core 6 framework unveiling example demonstration [03]:dapr initial experience](/img/fd/4c24e10fc91a7ce7e709a0874ba675.jpg)
ASP. Net core 6 framework unveiling example demonstration [03]:dapr initial experience

Internet enterprises need CRM software to help

Difference between URI and URL

Browser local storage
随机推荐
Can redis implement hot standby?
Meta metauniverse female safety problems occur frequently. How to solve the relevant problems in the metauniverse?
[MySQL technology topic] technical analysis and guide for analyzing the high availability architecture of MySQL
Design and practice of kubernetes cluster and application monitoring scheme
What is the "danksharding" of V God Kop on Valentine's day?
Are there too many programmers in China at present?
Small program large screen adaptation Guide
Can I cast int to a variable of type byte? What happens if the value is larger than the range of byte type?
Week 10 - task 0- execution process instance resolution of constructors and destructors
Clickhouse data type
Conditional test, if and case conditional test statements of shell script
Haar cascades and LBP cascades in face detection [closed] - Haar cascades vs. LBP cascades in face detection [closed]
Use of sed in shell script
Ctrip launched the "3+2" office mode. Are you sour?
RedisTemplate处理hash整数类型的问题解析
Establishing the development environment of esp8266
[Flink] flinksql and table programming cases
Call the computer calculator and use it to convert several base numbers
Problems with MySQL database query
Pointer from beginner to advanced (2)