Hello,

I am currently just getting started in learning my first programming language. I searched the web and decided to start with the book "The C Programming Language". The problem is I am already lost. I have no idea how to set up the Hello World program. I have a little experience coding in PHP and HTML but nothing like this. I'm not sure how to compile, what programs I need to do so, etc...

And with the commands they are giving me, I'm guessing that I need a program to type those into? I would appreciate any help on getting started. This is my first venture into the software/programming world. I start college in a few months and will be majoring in computer science. Any help would be greatly appreciated.

-Peter

Hello,

I am currently just getting started in learning my first programming language. I searched the web and decided to start with the book "The C Programming Language". The problem is I am already lost. I have no idea how to set up the Hello World program. I have a little experience coding in PHP and HTML but nothing like this. I'm not sure how to compile, what programs I need to do so, etc...

-Peter

For writing the code, any text editor will do, but a text editor that is designed to work with C/C++ would work better simply for things like syntax highlighting (which shows you visually the keywords and so forth). You could, however, write a program in NotePad. There is no rule against it.

For compiling the program, you need (naturally) a compiler. What is readily available to you depends on the system you have. If you search the internet, I would think that you should be able to find a Windows-compatible freeware C compiler somewhere without much difficulty. UNIX systems typically come with a compiler as part of the operating system. Typically compiler programs are called 'cc' or 'cc.exe', so the command to compile will typically start with cc.

Having said that, compiling is not the end of the road. Compiling will compile your program into 'object code'. It must then be linked with the libraries that have been used into an executable module (regardless of operating system). The linker program is typically called 'ln' or 'ln.exe'.

If you are new and are looking to get a rapid start, then picking up an IDE-driven system would speed your way greatly. An 'IDE' is an Interactive Development Environment, and basically provides you with a code editor and takes care of much of the bookkeeping of compiling and linking for you. That would be the 'quick-start' way to go. If you are on a Windows system, there are free 'Express' versions of Visual Studio available, and if you are on an UNIX system, then doubtless there is a similar thing available from the GNU project.

That should be enough to point you in the right direction. C is very powerful, flexible, and unforgiving, so it requires a fairly rigid self-discipline to program in well. If you can become expert in C programming, moving on to C++, C# and the like will be a largely down-hill ride. If you would like to start on an easier path, then C# is much more protective of the programmer, and syntactically very similar to C++, which is in turn very similar to C, so the reverse path is available, depending on your needs.

Uh, what?

By "msv6" do you mean Visual Studio 6? Thats a) not free b) not very standards compliant and c) old. "dev", which i guess means Dev-C++ is also dead. No new release since 2005.

The best bet is to download something like MinGW for windows and then either compile from the command line or use an IDE such as CodeBlocks (which works well with this toolchain)

I Third the vote for Code::Blocks

get the version "codeblocks-8.02mingw-setup.exe", it comes with the MinGW (gcc) compiler, and you cant go wrong. it's an industry standard.

I would not recommend that you use a text editor and stand-alone compiler to learn.... that will increase your frustration. i used to program that way for years, and now that i've finally moved over to IDE (integrated dev. environments) i wouldnt want to inflict notepad programming on anyone. its like going from dialup to broadband: you'll never go back.

otherwise, do stick with K&R's "The C Programming Language". you'll be better for it. you *could* get one of those "Teach yourself C" type of books, but you'll be cheating yourself.

i've just revisited the K&R book, and it is superior. make sure you use the Second Edition, though, that one is compliant with ANSI C.

also, you can get "The C Answer Book" by Tondo and Gimpel, published by Prentice Hall. It contains fully worked out solutions to all the exercises in K&R.

hmm... i just reread your post, i thought you were experienced in another language, but i see now that's not so much. (by the way, HTML is not a programming language, it's a markup language... just FYI.)


K&R was not really written for novice programmers. It's written for intermediate programmers who are learning C, but have a foundation in some other structured language

perhaps you might want to check out one of those Teach Yourself C books. like the Sam's series or the "____ For Dummies" series. I'm not recommending these,they don't have much professional credibility, but they will hold your hand through some of the beginner stuff.

just borrow one from the library, just long enough to build up some confidence in basics --- then come back to K&R


.

Ya I agree with jephtah . Start up with some easy book then when you think you know C to a certain extent you can come to K&R.

Or you can even come to Daniweb scan through the C forum. Because here you will get more than one ways to solve a particular problem and also the credentials of a particular way and its defects.And finally the best way to solve that problem.

Trust me just by reading the threads here you'll get to know a lot off stuff.

Hello,

I am currently just getting started in learning my first programming language. I searched the web and decided to start with the book "The C Programming Language". The problem is I am already lost. I have no idea how to set up the Hello World program. I have a little experience coding in PHP and HTML but nothing like this. I'm not sure how to compile, what programs I need to do so, etc...

And with the commands they are giving me, I'm guessing that I need a program to type those into? I would appreciate any help on getting started. This is my first venture into the software/programming world. I start college in a few months and will be majoring in computer science. Any help would be greatly appreciated.

-Peter

Yes, as explained, first you type the program in some editor. It could be Notepad also - the editor need not be complicated. Save the program in your hard disk and make a note of the file name and path name.

Then, run your compiler. If you are on an IDE, then you shall probably have a "compile" or "build" option. If you are doing from a command line (such as Unix), use the compiler invocation from the command line (such as "gcc" or "cc"), followed by the filename.

Your compiler would usually also take care of the linking option by default. Since you are a starter, I am assuming you use the basic compiler option and that links your single file program automatically.

Now, you should have your <filename>.exe or "a.out". From IDE, you would have a "run" option, so it would be a matter of simple click-and-run. In case of command line, you need to type in the name of the executable/out program and press the "Enter" key. That should take care of running the program.

In case the output is not what you expected, you need to come back to the program code and check the logic once more to rectify.
__________________
Far Infrared Sauna Portable sauna

Comments
this post does nothing but confuse the issue. if you're going to copy other people's posts, at least be coherent.
This article has been dead for over six months. Start a new discussion instead.