What Wrong With This C Prog?


Recommended Posts

I seem to be following my book exactly, but am getting numerous errors when compiling

here is the code

/* this my first c program*/

#include <stdio.h>

main()
{
   putchar(65);
   putchar(10);
   putchar(66);
   putchar(10);
   putchar(67);
   putchar(10);
   reuturn 0;
}

I am using this to compile it

shane@mainbox shane $ gcc test.c -o testc
test.c: In function `main':
test.c:13: error: `reuturn' undeclared (first use in this function)
test.c:13: error: (Each undeclared identifier is reported only once
test.c:13: error: for each function it appears in.)
test.c:13: error: syntax error before numeric constant

Link to post
Share on other sites

Well you spelled return wrong, I'm just starting to learn C so that's all I can help with though, but fix that and try running it.

Yea I just tested it with return fixed and it runs fine.

Edited by d_leet
Link to post
Share on other sites

thanks :blush: that was the problem. I thought that I erased this post, noticing my dumb error, espesially with this line

test.c:13: error: `reuturn' undeclared (first use in this function)

I should not have even had to ask what was wrong.

edit added later//

part of me not noticing the obvious error was I was looking to close at these errors

test.c:13: error: (Each undeclared identifier is reported only once
test.c:13: error: for each function it appears in.)
test.c:13: error: syntax error before numeric constant

I assumbed I had all kinds of things screwed up

Edited by shanenin
Link to post
Share on other sites

GCC has the least useful diagnostics I've ever seen in a piece of software. And I'm including ed. g++ is almost malicious.

BTW, -ansi -W -Wall are your friends.

Edited by jcl
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...