Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > Can't seem to ring that pole!

Reply
Thread Tools

Can't seem to ring that pole!

 
 
Lloyd Fuller
Guest
Posts: n/a
 
      01-18-2011
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?
 
Reply With Quote
 
 
 
 
Geoff
Guest
Posts: n/a
 
      01-18-2011
The case of the missing brace. Hurry Watson! The game's afoot!

On Mon, 17 Jan 2011 22:39:07 -0800 (PST), Lloyd Fuller
<(E-Mail Removed)> 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?

 
Reply With Quote
 
 
 
 
Ian Collins
Guest
Posts: n/a
 
      01-18-2011
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
 
Reply With Quote
 
litchie
Guest
Posts: n/a
 
      01-18-2011
You should delete the left bracket after `if (a == 0)'.
 
Reply With Quote
 
mikey@mouse.local
Guest
Posts: n/a
 
      01-20-2011
On Mon, 17 Jan 2011 22:39:07 -0800 (PST), Lloyd Fuller
<(E-Mail Removed)> 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;
}
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
problem in running a basic code in python 3.3.0 that includes HTML file Satabdi Mukherjee Python 1 04-04-2013 07:48 PM
RING RING RING Dashing through the wind, In a four dog dragged sleigh. Oh the street we go, laughing all the way Mathematician C++ 0 12-24-2006 02:26 PM
Ring Ring This Away strawberry.lina@gmail.com Computer Support 0 11-05-2005 08:01 PM
Digi-slave L-Ring Ultra II LED Ring Light Jim Hawkins Digital Photography 0 08-16-2005 12:12 PM
Ring ring....ring ring.... Slumpy Computer Support 1 07-06-2003 10:57 PM



Advertisments