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