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!

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

I am stumped. How to: Add two floats?

I am currently taking the functions challenge and I am stumped on adding the floats together, I know it is just a matter of syntax. This is my code. Please in the reply tell me what I need to do. Thank you.

void addtwo() int main() { } return 0; int addtwo

return 0; void addtwo( { float chicken = 24; float steak = 12;

chicken + steak; printf("24 + 12 = .\n");


1 Answer

Stone Preston
Stone Preston
42,016 Points

all you need to do is implement the function. you dont need the main method, and you dont need to define a function prototype or any variables.

below is a shell of what your function implementation should look like:

returnType functionName(dataType parameterOne, dataType parameterTwo) {

    return something;


the challenge tells you what to name the function, the data type of the arguments, and what it should return (it needs to add the parameters passed in to the function and return that sum). since the arguments need to be floats and you are adding them together you know the return type needs to be a float as well