# code-block-pro/1.27.6/build/shiki/samples/objective-cpp.sample

Code Block Pro – Beautiful Syntax Highlighting, version 1.27.6. 34 lines.

- Page: https://pluginprobe.com/plugins/code-block-pro/1.27.6/code/build/shiki/samples/objective-cpp.sample
- Raw: https://pluginprobe.com/plugins/code-block-pro/1.27.6/raw/build/shiki/samples/objective-cpp.sample
- Modified: 2023-09-03T01:04:34+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/code-block-pro/1.27.6/code/build/shiki/samples/objective-cpp.sample#L10-L20`.

```
#include <stdio.h>
#include <Block.h>
typedef int (^IntBlock)();

IntBlock MakeCounter(int start, int increment) {
  __block int i = start;

  return Block_copy( ^ {
    int ret = i;
    i += increment;
    return ret;
  });

}

int main(void) {
  IntBlock mycounter = MakeCounter(5, 2);
  printf("First call: %d\n", mycounter());
  printf("Second call: %d\n", mycounter());
  printf("Third call: %d\n", mycounter());

  /* because it was copied, it must also be released */
  Block_release(mycounter);

  return 0;
}
/* Output:
  First call: 5
  Second call: 7
  Third call: 9
*/

// From https://en.wikipedia.org/wiki/Objective-C

```
