.

code block program

<<

CTRLS

Newbie
Newbie

Posts: 25

Joined: Fri Jul 22, 2011 12:17 am

Post Mon Jul 25, 2011 11:10 am

code block program

i really need some help right now....my computer isnt running the program that i programmed...as of right now im reading the Teach Yourself C in 21 days and i wrote my first source code it looks something like this

#include<stdio.h>

main()
{
    printf("Hello, World!"/n);
    return 0;
}

and i complie it and try to build and run it but it does nothing!!!!
can someone help me out
<<

hell_razor

User avatar

Jr. Member
Jr. Member

Posts: 90

Joined: Wed Jul 14, 2010 10:44 am

Post Mon Jul 25, 2011 12:38 pm

Re: code block program

My C is crap...but shouldn't it be \n not /n ?
A+, Network+, Server+, CISSP, GSEC, GCIH, GPEN, GCIA, GISP, GCFW
<<

CTRLS

Newbie
Newbie

Posts: 25

Joined: Fri Jul 22, 2011 12:17 am

Post Mon Jul 25, 2011 12:39 pm

Re: code block program

hmm lemme try it out
<<

CTRLS

Newbie
Newbie

Posts: 25

Joined: Fri Jul 22, 2011 12:17 am

Post Mon Jul 25, 2011 12:40 pm

Re: code block program

it just tells me some bs that looks like this:

uses an invalid compiler. Probably the toolchain path within the compiler options is not setup correctly?!
<<

hell_razor

User avatar

Jr. Member
Jr. Member

Posts: 90

Joined: Wed Jul 14, 2010 10:44 am

Post Mon Jul 25, 2011 12:46 pm

Re: code block program

Oh yeah, my bad....move the \n inside the quotes, too.

printf("Hello, World!\n");
A+, Network+, Server+, CISSP, GSEC, GCIH, GPEN, GCIA, GISP, GCFW
<<

MaXe

User avatar

Hero Member
Hero Member

Posts: 671

Joined: Tue Aug 17, 2010 9:49 am

Post Mon Jul 25, 2011 12:51 pm

Re: code block program

CTRLS wrote:i really need some help right now....my computer isnt running the program that i programmed...as of right now im reading the Teach Yourself C in 21 days and i wrote my first source code it looks something like this

#include<stdio.h>

main()
{
     printf("Hello, World!"/n);
     return 0;
}

and i complie it and try to build and run it but it does nothing!!!!
can someone help me out


// Note the space between include and the header.
#include <stdio.h>

main()
{
    printf("Hello, World! \n");
    return 0;
}

It's been ages since I wrote C code, and if anything is wrong with that example, it would probably be the declaration of main() (In some languages you have to use "void" with main as well, but I'm noob so I forgot lol.)

Use Code::Blocks to compile the code as well, if you're on Windows. If you're on Linux, use "gcc". (e.g.: gcc sourcecode.c -o outputfilename )

After you've compiled the executable, if you're on linux, you may have to make it executable like this: chmod +x outputfilename
I'm an InterN0T'er

Return to Programming

Who is online

Users browsing this forum: No registered users and 0 guests

cron
.
Powered by phpBB® Forum Software © phpBB Group.
Designed by ST Software