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) Fundamentals of C Compile and Run

return value

include <stdio.h>

int main() {

// insert code here...
printf("Hello, World!\n");
return 0;

}

It says Hello, World however, it does not return an integar do any one knows how can I fix it ?

Hi there,

Here is the thing. Main does actually return 0, but I want to first ask you. Are you expecting printf() to return an integer or something else?

1 Answer

Hi Meteb,

As Daniel mentioned, you actually are returning a 0, but a returned value isn't printed. You would see the 0 that's being returned if you included another line below and outside the function to print main().

A more detailed explanation, along with some really great examples of this, can be found in the Swift documentation.

Hope that helps, let me know if you have more questions about returning vs printing!