当前位置:网站首页>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
边栏推荐
- Jenkins operation Chapter 5 trigger, configuration webhook, Jenkins parameterized construction
- What are the uses of static?
- Will the order of where conditions in MySQL affect the union index? Will where 1 =1 affect the use of the index? Does where 1 =1 affect the use of indexes?
- 2,5-di (3,4-dicarboxyphenoxy) - 4 '- phenylethynylbiphenyldianhydride (pephqda) / Qiyue custom supply porphyrin modified amphiphilic block copolymer peg113-pcl46-porphyrin
- There are two ways for golang to develop mobile applications
- Are there too many programmers in China at present?
- 2022.02.15 - 240. Lucky number in matrix
- Personal blog item: processing of reading number +1 after viewing article details
- 2022.02.15 - SX10-31. House raiding III
- Go basic data types: characters and strings
猜你喜欢

The most complete machine learning model training process

Jenkins operation Chapter 6 mail server sending build results

Servlet version conflict causes page 404

Sourcetree remote red exclamation point

RedisTemplate处理hash整数类型的问题解析

Games101 Lecture 10 geometry 1 Notes

Delete tag

Pytest (7) -yield and termination function

It turns out that the joys and sorrows of programmers are not interlinked

Sum of digits under k-ary representation of leetcode simple problem
随机推荐
[MySQL technology topic] technical analysis and guide for analyzing the high availability architecture of MySQL
Monitor employee turnover dynamics. This system makes employees tremble!
Devops development, operation and maintenance Basics: using Jenkins to automatically build projects and notify by email
ASP. Net core 6 framework unveiling example demonstration [03]:dapr initial experience
Ctrip launched the "3+2" office mode. Are you sour?
Case of single file component files
Testing grpc service with grpcui
Mongodb paging method
MySQL add / delete / modify query SQL statement exercise yyds dry goods inventory
Regular expressions for shell script values
National Defense University project summary
[Flink] flinksql and table programming cases
Observer mode vs publish subscribe mode
Clickhouse data type
Hyperledger Fabric 2. X custom smart contract
Benign competition will promote each other
Teach you how to develop your own NPM package (publish to the NPM official website)
Mongodb sort function
Segment in Lucene
Rich material libraries make modeling easy and efficient for developers