void (*isr_handle_array[50]) (void); How do you understand this statement??

Source: Internet
Author: User

This is an array of function pointers. It's good to peel one layer at a layer.

is an array of pointers to the return value of the void parameter and also void. First look inside [50] know is the array, and then look outward is a function pointer, together is a function pointer arrays. I write a source code, you will understand.

12345678910111213141516 #include <stdio.h>//这是你问题中的函数指针数组void(*isr_handle_array[50])(void); //这是两个返回值void 参数也是void的函数voidhello(void) { printf ("hello ");}voidworld(void) { printf("world\n");}intmain(){//这里把hello 和world两个函数的地址保存到数组中isr_handle_array[0] = hello;isr_handle_array[1] = world;//这里就可以通过数组直接调用函数啦。isr_handle_array[0]();isr_handle_array[1]();return0;}

The following results are performed:

Hello World

void (*isr_handle_array[50]) (void); How do you understand this statement??

Related Article

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.