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 trialBrady Sherman
3,320 Pointsneed help with functions
'''C float add_Two (float a,float b) { float a = 22; float b = 45; printf("%f is the total floating",add_Two(a,b)); return 0; } { float add_Two (float a,float b) return a + b; } '''
Says i need to "Implement a function named "addTwo" that returns the sum of two floats. The function will accept two float numbers as arguments and return a float which is the sum of the two arguments passed to the function."
1 Answer
Ben Rubin
Courses Plus Student 14,658 PointsTreehouse's validation engine requires your function names and variable names to be exact. Name your function addTwo instead of add_Two.
You can't declare variables a and b inside of your function. You're already passing them in as arguments. You're also not returning the sum. You're returning 0 from the function. Make sure you return the sum of the two numbers.
You should also take the printf
statement out. Sometimes having extra code can make the validation fail, even if it should succeed.