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

Surya Dutt
Courses Plus Student 2,875 Pointswhy main function in c language has an integer return type but not float or string return types?
return type of main function
1 Answer

Gabe Nadel
Treehouse Guest TeacherThe main function returns 0 (an int) because in general, a return of 0 would indicate that everything worked correctly, if some other number, like -2 or 14544 came back, we would know something went wrong. Yes, you could craft a string or float as a return type, but when you have option to use something simpler, like an int, that is a better option. Either returning 0 or NOT 0 is a very cut-and-dry way to know if it worked as expected.