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

diki dele audran
diki dele audran
516 Points

the action of implementing consist on righting the return line ?

i get stuck on challenge task 1 (the last of challenge 2)

3 Answers

Stone Preston
Stone Preston
42,016 Points

1 and 2 are not valid variable names. Try using float one and float two instead one float 1, float 2. And instead of 1 + 2 use one + two

Stone Preston
Stone Preston
42,016 Points

implementing a function just means writing the definition of the function. You dont need to write the main method. Your function should look something like this:

returnType functionName(dataType argumentOne, dataType argumentTwo) {

    return something;

}

In this case the challenge tells you the return type, what you need to name it, the data type of the arguments, and what you need to return (you need to return the sum of the arguments passed in)

diki dele audran
diki dele audran
516 Points

thanks, is there any difference between what is demonstrate on the last video of this chapter and what the challenge is asking me for ?

diki dele audran
diki dele audran
516 Points

iv right this ; float addTwo(float 1, float 2) {

return 1 + 2;

}

dont understanding what im doing wrong ?!