Official Forum for Programming in Objective-C (the iPhone Programming Language) - Stephen Kochan
September 20, 2018, 12:30:22 AM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
 
   Home   Help Search Login Register Chat  
Pages: [1]   Go Down
  Print  
Author Topic: Exercise 10  (Read 13913 times)
mic
Newbie
*
Posts: 4


« on: November 15, 2014, 02:11:35 PM »

#import <Foundation/Foundation.h>

void (^exchange)(int *, int *) = ^(int * i, int *j)
{
    int temp = *i;
    *i = *j;
    *j = temp;
};

int main(int argc, char * argv[])
{
    @autoreleasepool {
        int first = 1, second = 2;
       
        exchange(&first, &second);
       
        NSLog(@"first now is %i", first);
        NSLog(@"second now is %i", second);
    }
    return 0;
}
Logged
Pages: [1]   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Entire forum contents ゥ 2009 classroomM.com. All rights reserved.