Deep Dive into all aspects of Block, deep dive into block

Source: Internet
Author: User

Deep Dive into all aspects of Block, deep dive into block
Content outline:

1. Blocks Summary

2. Blocks Mode

3. Block essence (key points for interviews)

 

1. Blocks Summary

What is Blocks: Blocks is an extension function of C language. It can be expressed in one sentence as an anonymous function with local variables (some local variables are also called automatic variables. This function is called block. (Note that Blocks is a function and block is a function)

1-1. About "anonymous functions"

Anonymous functions: functions without names are anonymous functions. (However, the C language standard does not allow such a function .)

For example, in the source code below: if you do not use the name of the function to assign a value to the function pointer, the address of the function cannot be obtained:

However, with Block, the source code can use anonymous functions, that is, functions without names.

1-2. About "local variables (in some documents, local variables are also called automatic variables )"

To help you better understand this "with local variables (some local variables are also called automatic variables )",The process of callback for common functionsAndBlock Function callback ProcessIn this way, readers can better understand the significance of the block "with local variables (some local variables are also called automatic variables)" and the features of the block.

(It can be a feature by comparing the differences

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.