Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS Objective-C Basics (Retired) Functional Programming in C Functions

did not understood

where am i wrong

int addTwo (float 1, float 2) { return 1 + 2; }

2 Answers

I'm pretty sure variable/param names can't start with a number. And in the return statement you are returning 1+2, which will always return 3.

Make it

int addTwo (float first, float second) { return first + second; }

I'm not sure if that's the exact syntax, because I have not worked with obj C, but u get the idea.

And why are your params 'float', when the function is 'int'?

You're correct, and it also should return a float, so: (your syntax was fine):

float addTwo (float first, float second) { 
    return first + second; 
}

Yep. Either make the params int, or the function float.