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

Need help on functions. Not sure where I'm going wrong

Got stuck on this

What did you get stuck on? Can you provide a link or post your code?

3 Answers

Is 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;
}

{ int a = 69; int b = 96; printf("addTwo %d\n, addTwo(a, b)); return 0; }

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

Got 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

The 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.)