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

Functional Programming C Challenge

I am not sure what I am doing wrong here. I have spent about an hour and a half trying to figure this out. Please help or give me a hint at what I need to be looking at. Getting an error in Xcode that says redefinition of 'addTwo'

float addTwo(float a, float b) { float boo = 3.1465; float bee = 1.1689; printf("The sum is %f\n", addTwo(boo, bee)); return 0; }

float addTwo(float a, float b) { return a + b; }

4 Answers

I went back and looked at the challenge. I struggled with this question for awhile too, until I realized that they ONLY wanted the implementation of the function. You're giving more than they ask for, but you have the correct answer in there:

float addTwo(float a, float b) { return a + b; }

Good luck!

If you submitted both of those lines together then it would look like you're attempting to redefine the function. The first line of your code defines the function but then you're attempting to define it to be something else in your second line of code.

It turns out that your second line of code: float addTwo(float a, float b) { return a + b; } is what they're looking for. It accepts two arguments a and b and it returns the sum of those two arguments a + b

What was the quiz question?

Thank you for your replies!! I appreciate it!