Can't seem to ring that pole!

Discussion in 'C Programming' started by Lloyd Fuller, Jan 18, 2011.

  1. Lloyd Fuller

    Lloyd Fuller Guest

    I've been working on this for a while, but I just can't seem to ring
    that pole!

    so here is my function:

    const char * earth(int a)
    {
    const char *myearth;

    if (a == 0) {
    myearth = "15321.532";
    else {
    myearth = "a cool 600";
    }

    return myearth;
    }



    AND HERE is my main:

    int main (void) {
    printf("yofoo your earth is %s\n", earth(2));
    }

    But I get a lot of errors this is a mess. Any kind soul out there
    with some advice to help me ring this pole?
    Lloyd Fuller, Jan 18, 2011
    #1
    1. Advertising

  2. Lloyd Fuller

    Geoff Guest

    The case of the missing brace. Hurry Watson! The game's afoot!

    On Mon, 17 Jan 2011 22:39:07 -0800 (PST), Lloyd Fuller
    <> wrote:

    >I've been working on this for a while, but I just can't seem to ring
    >that pole!
    >
    >so here is my function:
    >
    >const char * earth(int a)
    >{
    > const char *myearth;
    >
    > if (a == 0) {
    > myearth = "15321.532";

    } /* <-- here it is */
    > else {
    > myearth = "a cool 600";
    > }
    >
    > return myearth;
    >}
    >
    >
    >
    >AND HERE is my main:
    >
    >int main (void) {
    > printf("yofoo your earth is %s\n", earth(2));

    return 0;
    >}
    >
    >But I get a lot of errors this is a mess. Any kind soul out there
    >with some advice to help me ring this pole?
    Geoff, Jan 18, 2011
    #2
    1. Advertising

  3. Lloyd Fuller

    Ian Collins Guest

    On 01/18/11 07:39 PM, Lloyd Fuller wrote:
    > I've been working on this for a while, but I just can't seem to ring
    > that pole!
    >
    > so here is my function:
    >
    > const char * earth(int a)
    > {
    > const char *myearth;
    >
    > if (a == 0) {
    > myearth = "15321.532";
    > else {
    > myearth = "a cool 600";
    > }
    >
    > return myearth;
    > }
    >
    >
    >
    > AND HERE is my main:
    >
    > int main (void) {
    > printf("yofoo your earth is %s\n", earth(2));
    > }
    >
    > But I get a lot of errors this is a mess. Any kind soul out there
    > with some advice to help me ring this pole?


    Does your editor auto-indent? If so, it will show you the missing
    closing brace!

    --
    Ian Collins
    Ian Collins, Jan 18, 2011
    #3
  4. Lloyd Fuller

    litchie Guest

    You should delete the left bracket after `if (a == 0)'.
    litchie, Jan 18, 2011
    #4
  5. Lloyd Fuller

    Guest

    On Mon, 17 Jan 2011 22:39:07 -0800 (PST), Lloyd Fuller
    <> wrote:

    >I've been working on this for a while, but I just can't seem to ring
    >that pole!
    >
    >so here is my function:
    >
    >const char * earth(int a)
    >{
    > const char *myearth;
    >
    > if (a == 0) {
    > myearth = "15321.532";
    > else {
    > myearth = "a cool 600";
    > }
    >
    > return myearth;
    >}
    >
    >
    >
    >AND HERE is my main:
    >
    >int main (void) {
    > printf("yofoo your earth is %s\n", earth(2));
    >}
    >
    >But I get a lot of errors this is a mess. Any kind soul out there
    >with some advice to help me ring this pole?


    const char * earth(int a)
    {
    const char *myearth;

    if (a == 0)
    myearth = "15321.532";
    else
    myearth = "a cool 600";

    return myearth;
    }



    int main (void)
    {
    printf("yofoo your earth is %s\n", earth(2));
    return 0;
    }
    , Jan 20, 2011
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. SpamProof
    Replies:
    3
    Views:
    976
    Sunwest Technologies
    Feb 26, 2004
  2. Smith

    ring tones

    Smith, Sep 15, 2005, in forum: Java
    Replies:
    1
    Views:
    468
    Chris Smith
    Sep 15, 2005
  3. Mathematician
    Replies:
    0
    Views:
    542
    Mathematician
    Dec 24, 2006
  4. Roedy Green

    OT ring ring

    Roedy Green, Aug 5, 2007, in forum: Java
    Replies:
    4
    Views:
    362
    Mike Schilling
    Aug 5, 2007
  5. Jon Todd
    Replies:
    3
    Views:
    279
    Sambo
    Jan 1, 2008
Loading...

Share This Page