Advertising (This ad goes away for registered users. You can Login or Register)

[Tutorial] Introduction to programming using C

Discuss about your favorite (gaming...or not) devices here. The most popular ones will end up getting their own categories
Programming discussions for your favorite Device
Forum rules
Forum rule Nº 15 is strictly enforced in this subforum.
User avatar
m0skit0
Guru
Posts: 3817
Joined: Mon Sep 27, 2010 6:01 pm

Re: [Tutorial] Introduction to programming using C

Post by m0skit0 » Thu Jul 07, 2011 12:33 pm

xist wrote:As for the book, it's a beginners book and i know nothing.... :roll:
IMHO C++ is not best language to start learning programming with.
xist wrote:(didn't get any errors btw...)
You shouldn't get any. I said "warning" not "error". And also you had to have your compiler set up properly to show all warnings (which I highly recommend).
Advertising
I wanna lots of mov al,0xb
Image
"just not into this RA stuffz"

venmalathy
Banned
Posts: 7
Joined: Tue Sep 06, 2011 10:30 am

Re: [Tutorial] Introduction to programming using C

Post by venmalathy » Mon Sep 12, 2011 11:19 am

Linux is quite easy to use, don't worry.
Advertising

nbl0mer
Banned
Posts: 43
Joined: Tue Sep 20, 2011 6:04 pm

Re: [Tutorial] Introduction to programming using C

Post by nbl0mer » Thu Sep 22, 2011 5:49 pm

nice tuturial man , nice work , bravo !!! and thanx for the help
Last edited by ultimakillz on Mon Sep 26, 2011 8:41 pm, edited 1 time in total.
Reason: no need to quote the whole tut
YT http://youtube.com/nbl0mer
Twitter http://twitter.com/#!/nbl0mer
I am 17, PC programmer
I make PSP Apps(SOOO EASY!!LIKE C++)
I want to make a cfw,say : good luck)

User avatar
N6v7d8
Posts: 31
Joined: Fri May 25, 2012 6:01 am

Re: [Tutorial] Introduction to programming using C

Post by N6v7d8 » Sat Jul 07, 2012 1:27 am

Excuse me o,o

I would like to ask if there is a way to compile/run C using Command Prompt like Java?

and what should be the file extension when using notepad?

because I prefer using notepad.

Thank you :)

User avatar
fate6
Big Beholder
Posts: 7598
Joined: Fri Mar 09, 2012 1:18 am
Location: [fate6@Canterlot ~]$

Re: [Tutorial] Introduction to programming using C

Post by fate6 » Sat Jul 07, 2012 2:46 am

the extension would still be the same
also notepad ? really ?

well what ever but I would suggest notepad++ (or better yet use a Linux Distro)
now as for CMD IDK since I dont code on Windows, sorry :/
(more like fail to code :3)
Image
anon wrote:If you can't trust a 600 year old vampire in a prepubescent girl's body, who can you trust?

User avatar
Xian Nox
Retired Mod
Posts: 2749
Joined: Fri Nov 05, 2010 5:27 pm
Location: Over the hills and far away

Re: [Tutorial] Introduction to programming using C

Post by Xian Nox » Sat Jul 07, 2012 4:16 am

N6v7d8 wrote:I would like to ask if there is a way to compile/run C using Command Prompt like Java?
Sure.

Code: Select all

gcc -o random.exe main.c
Works well for single-file projects. Also, gcc parameters are the same on Windows and Linux.
Extensions are .c and .h. When saving on notepad, write the name and extension like this:

Code: Select all

"main.c"
(Yes, with the ")

User avatar
N6v7d8
Posts: 31
Joined: Fri May 25, 2012 6:01 am

Re: [Tutorial] Introduction to programming using C

Post by N6v7d8 » Sat Jul 07, 2012 4:35 am

Xian Nox wrote:
N6v7d8 wrote:I would like to ask if there is a way to compile/run C using Command Prompt like Java?
Sure.

Code: Select all

gcc -o random.exe main.c
Works well for single-file projects. Also, gcc parameters are the same on Windows and Linux.
Extensions are .c and .h. When saving on notepad, write the name and extension like this:

Code: Select all

"main.c"
(Yes, with the ")
Thank you for the reply sir xD

I have another question o,o

where should I put that main.c?
and what should I type in command prompt to run it and test?

Thank you very much xD

I have installed Code::Blocks with MinGW
but as I said I prefer notepad since I'm confuse using CodeBlocks xD

User avatar
Xian Nox
Retired Mod
Posts: 2749
Joined: Fri Nov 05, 2010 5:27 pm
Location: Over the hills and far away

Re: [Tutorial] Introduction to programming using C

Post by Xian Nox » Sat Jul 07, 2012 9:56 am

N6v7d8 wrote:where should I put that main.c?
Any place you want. Just navigate to the same folder from the command prompt.
However, I do recommend you reading how to use makefiles once your projects start growing bigger than a single file. Tutorial here.
N6v7d8 wrote:and what should I type in command prompt to run it and test?
In the example I gave you, random.exe. -o defines the output. If undefined, it will be a.exe on Windows and a.out on Linux.
N6v7d8 wrote:I have installed Code::Blocks with MinGW
but as I said I prefer notepad since I'm confuse using CodeBlocks xD
Fair enough, but I'd recommend you getting some decent editor like Notepad++ or the sorts. Or better yet, getting a Linux distro and using gedit or kate.

User avatar
N6v7d8
Posts: 31
Joined: Fri May 25, 2012 6:01 am

Re: [Tutorial] Introduction to programming using C

Post by N6v7d8 » Sat Jul 07, 2012 11:12 am

Here it is, I create a new folder in C and put the main.c on it

I save as "main" that include " as you said

but when I try to run it on cmd, this thing happen.

Image

Is there something missing?

I'm sorry for many question xD

and thank you for always helping :)

User avatar
Xian Nox
Retired Mod
Posts: 2749
Joined: Fri Nov 05, 2010 5:27 pm
Location: Over the hills and far away

Re: [Tutorial] Introduction to programming using C

Post by Xian Nox » Sat Jul 07, 2012 11:23 am

N6v7d8 wrote:Is there something missing?
gcc. It's not installed or not in the path.
Most likely it's just not in your path, so here's how to add it to your path: Right click on My Computer --> Properties --> Advanced System Settings --> Environmental variables --> double click Path, and append the following:

Code: Select all

;C:\MinGW\bin
This is the path to your MinGW install, so if it's on a different path, change accordingly. Also, the Path shouldn't contain any spaces, and the different paths on it are separated by a semicolon.
Also, it's much easier to just select all in your console window, and use the code tag here to paste it. To do so, right click on the command prompt, click select, select what you want, then press Enter to copy it.

Post Reply

Return to “Programming and Security”