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

Totally lost on how to implement the float numbers. The previous lesson was on integers? The addTwo question.

if I don't need to add the main function, do I still need to use the --> { } ?

and the return implementation, is that just adding a return 0? Or does it mean to printf?

Jeremy Hayden
Jeremy Hayden
1,740 Points

Could you paste the question your stuck on? Also the code you have so far?

Thanks Jeremy for the reply. Didn't know that the Treehouse community was quite active. I finally managed to pull through.

Thanks!

1 Answer

Michael Hulet
Michael Hulet
47,913 Points

All you're doing is defining a C function. This code will pass:

//This tells the compiler that the function is named "addTwo", it returns a float, and it accepts 2 floats as parameters. One named "one", and one named "two
float addTwo(float one, float two){
  //this line just adds the two floats that were passed in together and returns them
  return one + two;
//This is just the closing curly brace to close the function
}

Thanks Michael! You saved me!