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

Paola Pimentel
Paola Pimentel
2,755 Points

I wrote my code, but it says that the argument has a type 'int (*)( )' obviously its wrong but I dont get it

the code is:

int addTwo () { float foo = 10; float bah = 5; printf("add two %d", addTwo);

return foo + bah;

}

1 Answer

Stone Preston
Stone Preston
42,016 Points

currently your function takes no arguments, you need to fix that. its returning the wrong data type (needs to return float). you shouldnt have to create any variables inside the function or print anything out.

here is a shell of what your function should look like:

returnType functionName(dataType argumentOne, dataType argumentTwo) {

return something;

}

the challenge tells you what the return type should be (float, not int), the function name, and the datatypes of the arguments (also floats). you can call the arguments (actually they are known as parameters in this case) whatever you want, just be consistent when referencing them. it says to return the sum of the arguments passed in to the function

Paola Pimentel
Paola Pimentel
2,755 Points

Thanx soooo much! :D I was so confused. Its a little bit harder for me since I'm not a native english speaker :P

thnx again!!