The use of function pointers

Source: Internet
Author: User

Today, when I browsed my post on www.armfans.net, I saw a very interesting and learning post, which gave me the use of function pointers in C. Now I want to repeat the content as follows:

A short period of wonderful C language, 1 and 2 to implement the same function. Welcome to share with us (Thank you very much, Mr. Trio)

1 void (* theuboot) (void );
....
Theuboot = (void (*) (void) (0x30700000 );
* Theuboot ();
.....

2 (* (void (*) (void) (0x30700000) (); the function pointer previously felt very Virtual. I have never seen a real example. This time I saw one, I think it is very helpful. I didn't quite understand it at the beginning. After the introduction of trio and the advanced C language courses, I understand theuboot = (void (*) (void) (0x30700000) converts the absolute address 0x30700000 into a function pointer assigned to theuboot, and then references the function pointed to by theuboot, this is useful for special functions that only know the function entry address, such as those that have not been declared, or functions that are not called in the same project.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.