The C Programming Language

Please support our C advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Jul 2009
Posts: 1
Reputation: macdonpr is an unknown quantity at this point 
Solved Threads: 0
macdonpr macdonpr is offline Offline
Newbie Poster

The C Programming Language

 
0
  #1
Jul 3rd, 2009
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
Reply With Quote Quick reply to this message  
Join Date: Nov 2008
Posts: 960
Reputation: MosaicFuneral is just really nice MosaicFuneral is just really nice MosaicFuneral is just really nice MosaicFuneral is just really nice MosaicFuneral is just really nice 
Solved Threads: 92
MosaicFuneral's Avatar
MosaicFuneral MosaicFuneral is offline Offline
Posting Shark

Re: The C Programming Language

 
0
  #2
Jul 3rd, 2009
"Jedenfalls bin ich überzeugt, daß der Alte nicht würfelt."
"I became very sensitive to what will happen to all this and all of us." -Two geniuses named Albert
Reply With Quote Quick reply to this message  
Join Date: Jul 2009
Posts: 3
Reputation: YrthWyndAndFyre is an unknown quantity at this point 
Solved Threads: 0
YrthWyndAndFyre YrthWyndAndFyre is offline Offline
Newbie Poster

Re: The C Programming Language

 
0
  #3
Jul 3rd, 2009
Originally Posted by macdonpr View Post
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.
Reply With Quote Quick reply to this message  
Join Date: May 2009
Posts: 212
Reputation: MrNoob has a little shameless behaviour in the past 
Solved Threads: 6
MrNoob's Avatar
MrNoob MrNoob is offline Offline
Posting Whiz in Training

Re: The C Programming Language

 
-2
  #4
Jul 3rd, 2009
also if your using win its better to use dev or msv6
Reply With Quote Quick reply to this message  
Join Date: Apr 2005
Posts: 16,201
Reputation: jbennet is a name known to all jbennet is a name known to all jbennet is a name known to all jbennet is a name known to all jbennet is a name known to all jbennet is a name known to all 
Solved Threads: 538
Moderator
Featured Poster
jbennet's Avatar
jbennet jbennet is offline Offline
Moderator

Re: The C Programming Language

 
-7
  #5
Jul 3rd, 2009
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)
If i am helpful, please give me reputation points.
Reply With Quote Quick reply to this message  
Join Date: Feb 2008
Posts: 1,607
Reputation: jephthah has much to be proud of jephthah has much to be proud of jephthah has much to be proud of jephthah has much to be proud of jephthah has much to be proud of jephthah has much to be proud of jephthah has much to be proud of jephthah has much to be proud of 
Solved Threads: 120
jephthah's Avatar
jephthah jephthah is offline Offline
Posting Virtuoso

Re: The C Programming Language

 
0
  #6
Jul 3rd, 2009
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.
Last edited by jephthah; Jul 3rd, 2009 at 11:59 pm.
Reply With Quote Quick reply to this message  
Join Date: Feb 2008
Posts: 1,607
Reputation: jephthah has much to be proud of jephthah has much to be proud of jephthah has much to be proud of jephthah has much to be proud of jephthah has much to be proud of jephthah has much to be proud of jephthah has much to be proud of jephthah has much to be proud of 
Solved Threads: 120
jephthah's Avatar
jephthah jephthah is offline Offline
Posting Virtuoso

Re: The C Programming Language

 
0
  #7
Jul 4th, 2009
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


.
Last edited by jephthah; Jul 4th, 2009 at 2:34 am.
Reply With Quote Quick reply to this message  
Join Date: Jan 2009
Posts: 476
Reputation: csurfer is just really nice csurfer is just really nice csurfer is just really nice csurfer is just really nice csurfer is just really nice 
Solved Threads: 76
csurfer's Avatar
csurfer csurfer is offline Offline
Posting Pro in Training

Re: The C Programming Language

 
0
  #8
Jul 5th, 2009
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.
Last edited by csurfer; Jul 5th, 2009 at 3:32 am.
I Surf in "C"....
Reply With Quote Quick reply to this message  
Join Date: Jul 2009
Posts: 2
Reputation: rampurhaat is an unknown quantity at this point 
Solved Threads: 0
rampurhaat rampurhaat is offline Offline
Newbie Poster

Re: The C Programming Language

 
-1
  #9
Jul 5th, 2009
Originally Posted by macdonpr View Post
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
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC