Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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,842 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!