Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

iOS Objective-C Basics (Retired) Fundamentals of C Variables

I am embarrassed to say this but I cannot create the float variable Radius....

I am having trouble declaring the variable Radius- the preceding video in this series did not seem to explain this aspect.

include stdio.h

int main(); { float radius = 14.5; }

4 Answers

Hi Dan, Check the way you are declaring your main() function - specifically where you are placing your semicolons.

Thanks Eric, I put the three lines below and it said to me : error message:

"conflicting types for 'main' int main(); ^ note: previous declaration is here int main(int argc, const char * argv[]"

include stdio.h

int main();

float radius = 14.5;

what gives?

fogey it! I just realized they just wanted: float radius = 14.5;

I am a moron!

Hey, glad you were able to figure it out. And don't worry, you're not a moron. Part of the challenge to the code challenged on here is figuring out exactly what they want. Its not always clear.

To answer the previous question, the (int argc, const char * argv[]) stuff are the parameters you would pass the main function when running from the command line and 'int' is the return type for the function. I think the C language section goes over that under the functions section (can't remember though). But for future reference, when writing your main function, don't put the semi colon after the (). It should read:

# include <stdio.h>

int main(int argc, const char * argv[]) {
    float radius = 14.5;
    return 0;
}

Hope that helps clarify it a bit.