Skip to content

Instantly share code, notes, and snippets.

@livid
Created July 25, 2010 01:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save livid/489173 to your computer and use it in GitHub Desktop.
Save livid/489173 to your computer and use it in GitHub Desktop.
#import <Foundation/Foundation.h>
int foo(int start, int end) {
NSLog(@"Hello");
int result;
int i;
int max = end + 1;
for (i = start; i < max; i++) {
result = result + i;
}
return result;
}
int main(int argc, const char * argv[]) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
int result1;
result1 = foo(1, 100);
int result2;
result2 = foo(1, 100);
NSLog(@"result1: %d", result1);
NSLog(@"result2: %d", result2);
[pool drain];
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment