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

angel galarza
angel galarza
2,441 Points

stucked

I'm stuck on this exercise:

Implement a function named "addTwo" that returns the sum of two floats. The function will accept two float numbers as arguments. It should add the two arguments together, and return the result. (No need to write the main function. Just write out the implementation for the addTwo function.)

this is my answer

float addtwo (float a, float b) {

return a + b;

}

I'm running it on Xcode like this and it works completely fine

include <stdio.h>

float addtwo(float a, float b); int main() { float one = 23.09; float two = 25.6758; printf ("addtwo %f\n", addtwo(one, two)); return 0; } float addtwo(float a, float b) { return a + b; } if anyone could help me

Dane Parchment
Dane Parchment
Treehouse Moderator 11,075 Points

I don't know, I haven't done this track before, but if it specified addTwo as the function name, then capitalize the T in two and see if that fixes it.

1 Answer

Dane Parchment
MOD
Dane Parchment
Treehouse Moderator 11,075 Points

I don't know, I haven't done this track before, but if it specified addTwo as the function name, then capitalize the T in two and see if that fixes it.

angel galarza
angel galarza
2,441 Points

I did used addTwo with a capital T before and it din't work, I must have mistyped the code prior to asking the question on the discussion, re-entered again with the capital T and it worked just fine Thanks