|
Programming C, bash, Python, Perl, PHP, Java, you name it. |
|
Thread Tools | Display Modes |
|
|
|||
Book(s) for learning C as a first language?
I wasn't sure where to post this thread because the Book Reviews section seems to be only for book reviews and not asking what books to read. I thought this section would be more suitable although I was also considering posting this to Off-topic.
My first language ever was Visual Basic, but I was 11 years old at the time and it was just an elective class I had to take that was mandatory towards getting credits in order to graduate school, and I didn't even know what a programming language was back then. I thought I was just writing words on the screen to make the program do things (we made stuff like tic-tac-toe, shooting a basketball into a hoop by inputting correct coordinates/arch, etc.) I forgot everything I learned since then, so I have absolutely no recollection at all of VB except the "rem" statement which I recall as being equivalent to a comment in any other language. Later when I began to rustle through much open source code and basically guessed what all the functions did and how the programs worked, I decided to learn a language and I had heard Python was easy so I started learning Python first. But before finishing the first chapter I was told by several people that Perl was much "better." Considering their opinion was probably better than mine, I switched to Perl and began on a book for beginners but again before I even learned the print function, I read that the first programming language one learns could be crucial to the person's future programming skills and habits that become ported to other programming languages they learn later on, and I don't want to develop any bad habits and practices. I've decided to choose C as my first language, for various personal reasons. So, as a newbie with no knowledge in programming at all whatsoever and wanting to learn C, I bought K&R's The C Programming Language (2nd edition) as per the advice on the OpenBSD website (since that's the OS I use). I read the disclaimers in the intro of the book, and read on anyway. But the book seems to move very fast and does not elaborate too much on the features of the language, I guess due to the book not being total-noob-friendly. I can barely follow along and get what's going on, but have no idea what the terminologies and phrases being used in the book mean since the book assumes the reader knows basic programming. Are there any books that are more noob-friendly that want to learn C as their first language? |
|
|||
Quote:
Without being able to answer these questions, you may dabble at it for awhile, & as life continually presents issues which have to be dealt with immediately, further study will get pushed back, & back, & back again. Ultimately, nothing gets accomplished. All languages have their learning curves, & understanding one's first language will be the hardest. From reading most of your posts over the last two years, I gather that programming isn't directly related to whatever you do professionally. That's fine, but for those outside of the industry, it is even more important to have a tangible goal in which you are wanting to surmount. If your goal is to fix sound on your MacPro as discussed on misc@, that is a highly ambitious goal. To get from A to B will require a significant amount of time & dedication. You can expect full understanding to take months to years depending upon how effectively you attack the problem, & how much time you have to commit to this particular endeavor. With no understanding of what your goals are, my suggestion is to start with something like Python first & learn to write increasingly more sophisticated code there. The learning curve is somewhat less steep in comparison to systems-level C programming, & you can become productive more quickly. Yet to reiterate the main point, unless you have a specific problem you are wanting to solve, you could easily fall into the trap of getting nowhere. |
|
|||
I already know that writing drivers is definitely not an easy thing to do. I've heard from people that do code them that it is hell. So that isn't my goal (as far as short-term vision goes; I will probably get another computer or maybe write drivers in the very, very future but highly likely as I'm not really interested in that subject and there are lots of talented folk who are already doing a pretty good job IMO.
Being an OpenBSD user for some time, I would eventually like to get into the security field and start being able to audit code for zero day exploits, on top of performing the compulsory penetration testing routine as well. The way I see it, the scan for existing issues are just previously known or recently disclosed zero days, so wouldn't it just be better to stay one step ahead in the first place? Granted that code auditing takes much more time (and arguably, skill), this is the reason why I would like to start practicing now and be able to read C in order to start Assembly later on and understand buffer overflows and the related family more, eventually auditing operating systems themselves (the ones written in C, at least). Does this clarify my intentions better so that I can be given more specific advice? |
|
|||
Quote:
I, too, learned C from K&R2, & I am also of the opinion that learning C as a first language is problematic. Others here may disagree, but anyone wanting to discuss this point should do so in a different thread. I only point this out here to admit my own bias. I also cringe at the thought of learning assembly language without having some general programming experience first. The problem in both cases is that both C & assembly language are very rich in the manner that expressions can be chained together, & without maintaining some discipline which comes from experience, the resulting program structure can be an unintelligible mess. If your goal is to become a pen tester, I see three aspects you need to focus upon to reach your goal or modify your expectations to be more realistic:
|
|
|||
If this is something you're interested in doing, enough to take the time to learn the ropes.. then don't let anyone discourage you.
It will take time, and effort, but if you read the latest undeadly article.. Henning Brauer only had a basic understanding of the C language when he first started using OpenBSD, but he has gone on to make very large and influential changes to the networking stack and PF. There are a lot of people who prefer using high level languages for occasion programming tasks, but there is a lot to be said about learning how to use system-level languages and getting a better grasp on how things work, like memory allocations, pointer management. I find obscuring those details to be a negative influence on programmers, languages like VB tend to shield even basic concepts about computers away from their users, adding a layer of eye candy and misdirection. Indeed it is a matter of personal taste, perhaps you shouldn't limit your "pallet", but I would wager a person using C alone would be better off than someone who used an interpreted language. http://undeadly.org/cgi?action=artic...20101115091138 |
|
||||
It may not be the best book for "Holding the newbies hand", as newbies have gotten greener since it was written, but for learning C, I would recommend The C Book and a copy of the ISO standard for C99 when you need a precise reference.
If you really want to *know* C, the C book is a good start.
__________________
My Journal Thou shalt check the array bounds of all strings (indeed, all arrays), for surely where thou typest ``foo'' someone someday shall type ``supercalifragilisticexpialidocious''. |
|
||||
My 2 cents, assuming you choose to stick with C, is not to give up entirely on K&R. Yes, it definitely should be supplemented with some more modern reading (which I don't really have any good suggestions about), but K&R is a very good classic book.
When I first started to learn C (coming from a weak fortran background) I was lucky enough to have a copy of K&R sort of fall into my hands. First time into it it all seemed so freakin weird, and I soon gave up. But later I went back to it and things started to make more sense, and I ended up working through most of it. It's a concise book, so there's real meat in every paragraph, and no fluffy sidebars about "Understanding Semicolons For Dummies", so you can't really rush through it. But with every chapter you've accomplished something. Also, since it sounds like you'd be not only learning the C language, but also learning programming alongside, it would be really important to work all (or most) of the problems to gain that sometimes painful experience. |
|
|||
I'll send as pm first
Last edited by unicyclist; 26th November 2010 at 03:18 AM. Reason: pm |
|
|||
"Problem Solving and Program Design in C" by Hanly and Koffman is really good.
I have the second edition I am using it right now. There is already sixth edition out there. "C How to program" by Deitel and Deitel is good but I prefer "Problem Solving and Program Design in C". I think you can only benefit to learn C, at least it wont hurt. I sure like the speed of compiled C code. |
|
|||
I agree that assembly language and C are key to learning how systems work and should be learned first. I don't believe anything should be abstracted away when you know nothing about it. However, esr believes Python is the best 'first language'.
It may depend on the person. In my case, as I'm coding, I visualize how the cpu fetches data from memory and physically sends it to ports and devices; but my background is hardware design. One may not need to think that way is writing a graphics program but doing driver development, my way of thinking would probably help immensley. |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Can anybody recommend a book for learning how to work with OpenBSD firewalls? | jepettrey | OpenBSD Security | 6 | 24th November 2010 02:28 PM |
C language inventor spurns Google's language exam | J65nko | News | 4 | 22nd April 2010 09:07 AM |
Learning how to program | Solaris_Delta | Programming | 9 | 24th December 2008 07:58 PM |
Learning Programming | Crypt | Programming | 35 | 27th October 2008 04:54 PM |
Learning Perl | mtx | Book reviews | 7 | 22nd October 2008 05:55 PM |