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

Lewis Davidson
Lewis Davidson
694 Points

Stuck already need help writing radius float in early lesson.

how to write a float variable specific question:

Create a float variable named 'radius' with the value '14.5'. (Do not write the main function).

5 Answers

Stone Preston
Stone Preston
42,016 Points

you create a float variable like so

float variableName = value;

so to create one named radius with a value of 14.5:

float radius = 14.5;
Chris Shaw
Chris Shaw
26,676 Points

Hi Lewis,

If you go back to the variables video Douglass has a float variable on the screen, that is what the challenge is asking for but using the value of 14.5 instead.

Lewis Davidson
Lewis Davidson
694 Points

This is what I put for the code:

#include <stdio.h>

int main()
{

    int days_in_a_week = 7;
    float cm_to_in = 2.54;
    float radius = 14.5;

    char the_w;

    the_w = 'W';

    printf("%d days in a week. \n", days_in_a_week);
    printf("%f cm per in.\n", cm_to_in);
    printf("The %c is a cool hotel\n", the_w);

    return 0;
}
Lewis Davidson
Lewis Davidson
694 Points

conflicting types for 'main' int main() ^ note: previous declaration is here int main(int argc, const char * argv[]) ^ 2 errors generated.

Lewis Davidson
Lewis Davidson
694 Points

thanks all. got it just write that one sample line is all!