August 2011
Intermediate to advanced
552 pages
23h 48m
English
Rewrite this function as a block:
int k(void) {
return 1;
}
Write a function create_k that accepts a single
integer argument i and returns a block. The
returned block accepts no arguments and always returns the value of
i passed to create_k().
Use this function in a test program. (Be careful with the block
memory management!)
Define two blocks called add_one and add_two that accept no arguments and return nothing. These should both increment the same integer by one or two. (You will need the __block storage specifier.)
Use typedefs to simplify the following block reference declaration:
int (^(*(^get_block_factory_funcptr)(void))(int))(void); ...
Read now
Unlock full access