Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //
- // main.m
- // Memory
- //
- // Created by Steve on 11/6/12.
- // Copyright (c) 2012 Personal. All rights reserved.
- //
- #import <Foundation/Foundation.h>
- int square(int n) {
- int retval = n * n;
- return retval;
- }
- int * memget() {
- int * pInt = malloc(10 * sizeof(int));
- if (!pInt) {
- // handle the error
- return;
- }
- *pInt = 5;
- // When done with the memory...
- free(pInt);
- }
- int main(int argc, const char * argv[])
- {
- int i = 5;
- printf("i squared is %d\n", square(i));
- return 0;
- }
Add Comment
Please, Sign In to add comment