Welcome to the Linux Foundation Forum!

So, I decided to...

teach myself C programming. I'm a first year Computer Science student. I taught myself bash scripting before taking this course, and that was during high school(same time I started using Linux). Unfortunately, they don't teach C in our University. They introduced C++ in the first semester, just the basics, we didn't even get to functions and other stuffs like arrays. Second semester is almost done and they're teaching us Java and I heard it's gonna be Java all the way. Maybe a few look back to C++ but that's it. No C. I know C is almost like C++(It doesn't matter, they won't teach us that much C++ anyway). But I've been reading on the internet and have read that Linux kernel is mostly in C(I wanna contribute someday, you know :D ) For some time I've been looking for some books in the library and found this book entitled Sams Teach Yourself C Programming in Linux in 21 days. It's year 2000 edition. So I was wondering if this book is good(for those who have read it). The book is 12 years old now, can't help to think that some (or maybe most) of the things here are outdated. Is it? Has a lot of things changed in C language in 12 years? And also this might be a stupid question, but i'm gonna ask anyway. Should I do my programming in Linux or Windows? Most people in our place use Windows(seems like I'm the only one who knows and uses Linux) so if I were to try and port my programs to, say, my friend's or school computers to test my codes, is it gonna be hard and gonna need a lot of tricks? I know the book says "C Programming in LINUX" but I want to test it on both systems but do it mostly for Linux. And one more reason why I want to do it on Windows too is because my box broke last week(stupid ants made their nest inside my harddisk) so I'm on my Mom's laptop right now and this doesn't have Linux because my Mom doesn't want Linux on it. VM is not an option because this laptop is kinda slow. "Hey, there are distros out there that can run on slow machines" No, just no Linux on this laptop. So I might have to start learning C on this laptop. And one more question, does GNU C Compiler work well on Windows? How do I get it running on Windows?

I don't even know if this is the right place to post this topic on Getting Started with Linux forum but, hey, I'm trying to get something started here. Any help is appreciated.

jeromesevilla (at) hotmail (dot) co (dot) uk

Thanks.

Comments

  • mfillpot
    mfillpot Posts: 2,177
    First lets look at C, GCC has C99 (revision in 1999) support, but has limited C11 (2007 - 2011 revisions) (http://gcc.gnu.org/onlinedocs/gcc/Standards.html) support, so little has changed since the book was published that can or is being in kernel. That all means that your book should still offer most of the content that you will be working with. To get some real experience get a kernel hacker book, which will explain more about the common implementations and the submission process.

    There are ports of GCC like http://www.mingw.org/http://www.mingw.org/ for windows, but they are often incomplete, gcc was built to work in Unix environments. Most of the code you write in Linux may work in windows, but the different libraries may cause the most trouble when compiling in windows or vice versa.

    As for your school programming, since you will be working in java, it is multi-OS thanks to the VM usage, so most programming will work on all operating systems.
  • Glad to see you here.
    You made a good[the best] decision , Learning 'C'

    "I know C is almost like C++ "
    No. C++ is almost like 'C', with some more feautres and filling the de-merits of 'C' .

    If you really want to learn 'C' in a deep, avoid some sort of books, which is based on the Number of Days to complete [ without considering the reader's capacity ] .

    Get one copy of "The C Programming Language" By, the 'C'-language creators, Ritchie and Ken Thomson.

    I bet, you will enjoy that.

    you can use Mingw in Windows as Mfillpot told, and turbo c if you want , till you get rid of ants.

    If your harddrive alone affected, remaining parts are good means, you can do,

    1. remove your hard disk
    2. Get one Linux Live CD/DVD or even USB
    3. Boot from CD/DVD/USB
    4. Learn 'C' pgm, do 'C' pgm and dont forget to copy your work to another medium, [ just a pen drive].

    If you want soft copy of that book, just let me to know

    Have a great stay here,
  • sevv
    sevv Posts: 3
    Thanks for the quick reply.
    @mfillpot - thanks for that info. Now I'm relieved that the books in my University's library about C are still good(They're mostly 88 and 90's edition. Probably the 2000 edition is the most current they have).

    @crond - I'll try your suggestion. I never thought that these insects can break electronic devices. And about the soft copy of the book - that'd be great. Is it for free? hehe.

    I have a question. I have Ubuntu 11.10 and Fedora 15 KDE CDs. Does GCC come with these distros?
  • " Is it for free? "
    No doubt in that. I am very very happy to share with anyone if they interested.
    Right now am in work place. Will send to your id, you mentioned in your first post, once I reach my home.

    Regarding the last part, I prefer Fedora, since thats my very first Linux distro .ANd moreover, the "vi" editor that you will use to do 'C' program, in Fedora is good, whereas in Ubuntu you need to update the same for easy use.

    If you are installing any one of those, in your hard drive you need to choose the "GCC" option to install [ in fedora ] .
    If you are trying as Live CD/DVD boot without hard drive, it will be there. I remember, I used it .
  • sevv
    sevv Posts: 3
    Yay, thanks!
    I've been using Fedora until my box broke. And yeah, I've used vi on Ubuntu and it sucked.
  • marc
    marc Posts: 647
    vim powah!!!

    You can learn C in almost any operating system, only the tools will change.

    Regards,

    Marc

Categories

Upcoming Training