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
busterlabs
9,276 PointsNeed help on functions. Not sure where I'm going wrong
Got stuck on this
3 Answers
Kristen Law
16,244 PointsIs this the code challenge you're working on? https://teamtreehouse.com/library/functions
If it is, it's asking you to return the sum of two floats, so you would need to replace your ints with floats. See below:
float addTwo(float a, float b) {
return a + b;
}
busterlabs
9,276 Points{ int a = 69; int b = 96; printf("addTwo %d\n, addTwo(a, b)); return 0; }
int addTwo(int a, int b) { return a + b; }
busterlabs
9,276 PointsGot this on the end part of my code, also figured out that i need to change the int to float. Ig et confused though on which part i need to write. In this case, if you didn't tell me to write the last part of the code, I would've kept writing everything. Thanks
Kristen Law
16,244 PointsThe code challenge will usually tell you what you need to write. For example, at the end of this task, it says
(No need to write the main function. Just write out the implementation for the addTwo function.)
Kristen Law
16,244 PointsKristen Law
16,244 PointsWhat did you get stuck on? Can you provide a link or post your code?