Upcoming SlideShare
Loading in...5
×
 

Functions in Objective-C and C Programming

on

  • 494 views

Course Link: http://skl.sh/11kA0im ...

Course Link: http://skl.sh/11kA0im
Website: http://iPhoneDev.tv

Learn about functions which allow you to organize your code into chunks. Functions allow you to delegate work between different blocks of code.

Statistics

Views

Total Views
494
Views on SlideShare
494
Embed Views
0

Actions

Likes
1
Downloads
5
Comments
0

0 Embeds 0

No embeds

Accessibility

Upload Details

Uploaded via as Adobe PDF

Usage Rights

CC Attribution-ShareAlike LicenseCC Attribution-ShareAlike License

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Functions in Objective-C and C Programming Functions in Objective-C and C Programming Presentation Transcript

    • Paul SoltiPhoneDev.tvFunctionsInstruction manuals for computers
    • Paul SoltiPhoneDev.tvOutline•Functions•Stack Frame•Recursion•Debugging•GlobalVariables
    • Paul SoltiPhoneDev.tv
    • Paul SoltiPhoneDev.tvDesk1. Build small drawer2. Build large drawer3. Build desk frame4. Insert small drawer5. Insert large drawer
    • Paul SoltiPhoneDev.tvArea = A x BAreaAB
    • Paul SoltiPhoneDev.tvint area(int sideA, int sideB)
    • Paul SoltiPhoneDev.tvint area(int sideA, int sideB)return type
    • Paul SoltiPhoneDev.tvint area(int sideA, int sideB)namereturn type
    • Paul SoltiPhoneDev.tvint area(int sideA, int sideB)name parameterreturn typeparameter
    • Paul SoltiPhoneDev.tvint area(int sideA, int sideB)
    • Paul SoltiPhoneDev.tvint area(int sideA, int sideB){int result = sideA * sideB;return result;}
    • Paul SoltiPhoneDev.tvint total = area(4, 2);
    • Paul SoltiPhoneDev.tvint total = area(4, 2);arguments
    • Paul SoltiPhoneDev.tvint total = area(4, 2);8arguments
    • Paul SoltiPhoneDev.tvint total = area(4, 2);
    • Paul SoltiPhoneDev.tvStack Frame•“Sandbox”•LocalVariables
    • Paul SoltiPhoneDev.tvStack Frame•“Sandbox”•LocalVariablesmain()total = area(4,2);
    • Paul SoltiPhoneDev.tvStack Frame•“Sandbox”•LocalVariablesmain()total = area(4,2);area(4,2)sideA = 4sideB = 2result = 8
    • Paul SoltiPhoneDev.tvStack Frame•“Sandbox”•LocalVariablesmain()total = area(4,2);
    • Paul SoltiPhoneDev.tvStack Frame•“Sandbox”•LocalVariablesmain()total = 8;
    • Paul SoltiPhoneDev.tvStack Frame•“Sandbox”•LocalVariables
    • Paul SoltiPhoneDev.tvArea
    • Paul SoltiPhoneDev.tvRecursionSpace Shuttle: CountdownTimer1. Display number2. Subtract one3. Repeat steps 1 and 2 (until 0) STS-110, NASA
    • Paul SoltiPhoneDev.tvRecursion
    • Paul SoltiPhoneDev.tvRecursionvoid countDown(int number) {if(number == 0) {printf("Take off!n");} else {printf("T-minus %d secondsn", number);int nextNumber = number - 1;countDown(nextNumber);}}
    • Paul SoltiPhoneDev.tvRecursionvoid countDown(int number) {if(number == 0) {printf("Take off!n");} else {printf("T-minus %d secondsn", number);int nextNumber = number - 1;countDown(nextNumber);}}
    • Paul SoltiPhoneDev.tvRecursionvoid countDown(int number) {if(number == 0) {printf("Take off!n");} else {printf("T-minus %d secondsn", number);int nextNumber = number - 1;countDown(nextNumber);}}
    • Paul SoltiPhoneDev.tvStack Frame
    • Paul SoltiPhoneDev.tvStack Framemain()startNumber = 5countDown(5)
    • Paul SoltiPhoneDev.tvStack Framemain()startNumber = 5countDown(5)countDown(5)nextNumber = 4countDown(4)
    • Paul SoltiPhoneDev.tvStack Framemain()startNumber = 5countDown(5)countDown(5)nextNumber = 4countDown(4)countDown(4)nextNumber = 3countDown(3)
    • Paul SoltiPhoneDev.tvStack Framemain()startNumber = 5countDown(5)countDown(5)nextNumber = 4countDown(4)countDown(4)nextNumber = 3countDown(3)countDown(3)nextNumber = 2countDown(2)
    • Paul SoltiPhoneDev.tvStack Framemain()startNumber = 5countDown(5)countDown(5)nextNumber = 4countDown(4)countDown(4)nextNumber = 3countDown(3)countDown(3)nextNumber = 2countDown(2)countDown(2)nextNumber = 1countDown(1)
    • Paul SoltiPhoneDev.tvStack Framemain()startNumber = 5countDown(5)countDown(5)nextNumber = 4countDown(4)countDown(4)nextNumber = 3countDown(3)countDown(3)nextNumber = 2countDown(2)countDown(2)nextNumber = 1countDown(1)countDown(1)nextNumber = 0countDown(0)
    • Paul SoltiPhoneDev.tvStack Framemain()startNumber = 5countDown(5)countDown(5)nextNumber = 4countDown(4)countDown(4)nextNumber = 3countDown(3)countDown(3)nextNumber = 2countDown(2)countDown(2)nextNumber = 1countDown(1)countDown(1)nextNumber = 0countDown(0)countDown(0)take off!
    • Paul SoltiPhoneDev.tvStack Framemain()startNumber = 5countDown(5)countDown(5)nextNumber = 4countDown(4)countDown(4)nextNumber = 3countDown(3)countDown(3)nextNumber = 2countDown(2)countDown(2)nextNumber = 1countDown(1)countDown(1)nextNumber = 0countDown(0)
    • Paul SoltiPhoneDev.tvStack Framemain()startNumber = 5countDown(5)countDown(5)nextNumber = 4countDown(4)countDown(4)nextNumber = 3countDown(3)countDown(3)nextNumber = 2countDown(2)countDown(2)nextNumber = 1countDown(1)
    • Paul SoltiPhoneDev.tvStack Framemain()startNumber = 5countDown(5)countDown(5)nextNumber = 4countDown(4)countDown(4)nextNumber = 3countDown(3)countDown(3)nextNumber = 2countDown(2)
    • Paul SoltiPhoneDev.tvStack Framemain()startNumber = 5countDown(5)countDown(5)nextNumber = 4countDown(4)countDown(4)nextNumber = 3countDown(3)
    • Paul SoltiPhoneDev.tvStack Framemain()startNumber = 5countDown(5)countDown(5)nextNumber = 4countDown(4)
    • Paul SoltiPhoneDev.tvStack Framemain()startNumber = 5countDown(5)
    • Paul SoltiPhoneDev.tvStack Frame
    • Paul SoltiPhoneDev.tvCountDown!
    • Paul SoltiPhoneDev.tvGlobalVariablesint total = 10resetTotal()total = 0;updateTotal()total = total + 1;
    • Paul SoltiPhoneDev.tvGlobalVariables
    • Paul SoltiPhoneDev.tvReview•Functions•Stack Frame•Recursion•Debugging•GlobalVariables
    • Paul SoltiPhoneDev.tv