当前位置:网站首页>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
边栏推荐
- Where is the Gcov symbol- Where are the gcov symbols?
- Why can't the article be posted?
- 层次分析法
- Rearrangement string of leetcode simple question
- Sourcetree remote red exclamation point
- Clickhouse data type
- Sum of digits under k-ary representation of leetcode simple problem
- Fresnel diffraction with rectangular aperture based on MATLAB
- Test Development - ten years of sharpening one sword (VII) interface test tool postman
- Part 63 - interpreter and compiler adaptation (II)
猜你喜欢

Introduction to Ceres Quartet

Hyperledger Fabric 2. X custom smart contract

JIRA basic usage sharing

Devops development, operation and maintenance Basics: using Jenkins to automatically build projects and notify by email

Fresnel diffraction with rectangular aperture based on MATLAB

Easy to understand TCP four waves (multi picture explanation)

The first commercial spacewalk of mankind is finalized! Musk SpaceX announced a new round of space travel plan, and the American rich became repeat customers

Teach you how to develop your own NPM package (publish to the NPM official website)

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

分享 10 个 JS Promise 相关的面试题
随机推荐
Rich material libraries make modeling easy and efficient for developers
Installing modules in pycharm
Convert data frame with date column to timeseries
Personal blog item: processing of reading number +1 after viewing article details
Conditional test, if and case conditional test statements of shell script
Pytest (7) -yield and termination function
Chapter V online logic analyzer signaltap
About: deleting unwanted event log lists
How to use regex in file find
How to change the password after forgetting the MySQL password (the latest version of 2022 detailed tutorial nanny level)
It turns out that the joys and sorrows of programmers are not interlinked
The simple problem of leetcode is to divide an array into three parts equal to sum
力扣今日题-324. 摆动排序 II
Is there any difference between a=a+b and a+=b?
Stack -- 739 Daily temperature
What is 'EC2-Other' filter in 'Cost Explorer' dashboard mean? [closed]
String and variable are spliced into variable name
Maximum ascending subarray sum of leetcode simple problem
[MySQL technology topic] technical analysis and guide for analyzing the high availability architecture of MySQL
Segment in Lucene