Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //
- // main.m
- // ScratchObjC
- //
- // Created by Don Mag on 3/17/20.
- // Copyright © 2020 Don Mag. All rights reserved.
- //
- #import <UIKit/UIKit.h>
- #import "AppDelegate.h"
- // MACRO definition
- #define MACROSUM(a, b) a + b;
- // BLOCK declaration
- int (^BLOCKSUM)(int, int) = ^(int a, int b) {
- return a + b;
- };
- // Function
- int functionSum(int a, int b) {
- return a + b;
- }
- int main(int argc, char * argv[]) {
- int x = 0;
- x = 1 + 2;
- NSLog(@"Assignment result: %d", x);
- x = functionSum(3, 4);
- NSLog(@"Function result: %d", x);
- x = MACROSUM(5, 6);
- NSLog(@"Defined Macro result: %d", x);
- x = BLOCKSUM(7, 8);
- NSLog(@"Declared Block result: %d", x);
- x = ^(int a, int b) {
- return a + b;
- }(9, 10);
- NSLog(@"Inline Block result: %d", x);
- NSString * appDelegateClassName;
- @autoreleasepool {
- // Setup code that might create autoreleased objects goes here.
- appDelegateClassName = NSStringFromClass([AppDelegate class]);
- }
- return UIApplicationMain(argc, argv, nil, appDelegateClassName);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement