FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


New endeavour: C programming language





davidv
So, right now I'm working on multiple solo projects using Java, Python, and a bunch of web dev stuff (boring markup, javascript, cgi, php) but I'd like to do more. Next semester I'll be using C as a tool for parallel programming in multi-core architectures within a unix environment. I thought I'd get ahead and learn C before the semester begins (which is roughly in 3 months).

Anyway, does anyone know any good resources online that assumes I have programming experience? I want something that teaches the specifics of C and skips the basics (vars, funcs, scopes, basic data structures etc.). Once I get the hang of the syntax, I can typically just read the documentation.

I know that C is quite a small language and isn't OO. Which is good because I'm kind of sick of OO at the moment (I have a little python script with over 200 functions and 5 different classes... searching for a particular function is a pain in the ass or worse having a single function that's needed by multiple objects, figuring out a way to allow each object to use it without code repetition is so annoying) ... which is why I just want to learn C right now and not C++.

On a side note: How do you guys manage your code once it gets over 1,500+ lines? Are there any tricks or funny techniques you guys have? Right now, I mostly just categorize functions and place them into their own group; then shove that group into its own class but when I have to make multiple calls to a function in another class which calls another function in another class... so on, it can get quite long.
Peterssidan
From what I have heard The C Programming Language by Kernighan and Ritchie should be very good book for learning C. It's not an online resource but I found this page that I think can be useful http://www.iso-9899.info/wiki/Books

In case anything explains the basics you can just skip it, but don't assume everything works like in Java or Python.

It is possible to do OOP in C but you need to do more work as a programmer. A little warning if you want to learn C++ in the future. Many people that know a lot of C and switch to C++ often use a very C stylish C++ and never learn to use it properly. This is because most C is valid C++ code so they are never forced to learn anything.

In C++ and Java I often put each class in it's own file. Free functions and small classes can also go in the same file if they are closely coupled to the that class. In C++ I sometimes put one function into it's own file. The main function often gets it's own file. I haven't used C that much so I'm not experienced how to separate the code but I guess it can work in a similar way. If you have a struct and a couple of functions working on that struct you can put them into the same file.
davidv
Peterssidan wrote:
From what I have heard The C Programming Language by Kernighan and Ritchie should be very good book for learning C. It's not an online resource but I found this page that I think can be useful http://www.iso-9899.info/wiki/Books


Thanks for the suggestion. I'm probably just gonna spend a decent amount of money and buy myself a book sometime in the next two weeks. Maybe, "The C Programming Language by Brian W. Kernighan, Dennis M. Ritchie".

Peterssidan wrote:
It is possible to do OOP in C but you need to do more work as a programmer. A little warning if you want to learn C++ in the future. Many people that know a lot of C and switch to C++ often use a very C stylish C++ and never learn to use it properly. This is because most C is valid C++ code so they are never forced to learn anything.


Yes, I've heard many nightmarish tales of people not knowing how to use C++ properly. Thankfully, I will be formally taught the language in the second last year of my degree so I'm not too fussed about it at the moment.

Peterssidan wrote:
In C++ and Java I often put each class in it's own file. Free functions and small classes can also go in the same file if they are closely coupled to the that class. In C++ I sometimes put one function into it's own file. The main function often gets it's own file. I haven't used C that much so I'm not experienced how to separate the code but I guess it can work in a similar way. If you have a struct and a couple of functions working on that struct you can put them into the same file.


Not many people appreciate a well structured expanding piece of code. I love refactoring, I love testing, I love efficiency and I love simplicity. Most people have the mentality that if it works, it works. Definitely signs of a bad programmer and the type of people that I'd never want to work with. But anyway, that's a different story. As regards to the way you set out your code, that's kind of the way I do it too with the exception of having a single function in it's own file. Currently, I have 5 classes in a single file (it makes it a bit easier for when I'm distributing my code to friends for testing). I'll probably adapt to a better construct when my script approaches the 2,000+ lines mark, which will be quite soon at my current rate.
Related topics
linux-windows c/c++ programming
linux windows c programming
Game Making
how did you learn about html, php or other languages???
Best Programming Language to Use
PROLOG programming
About pascal programming language
Survey on Programming Language
Can c++ still be kald a programming language?
Day 02 Preferred programming language?
To learn a programming language: Python
Introduction to C++ Programming+First Program
3 Websites To Get Started With Learning C++ Programming Lan
Good Cross Platform Programming Language
Reply to topic    Frihost Forum Index -> Scripting -> Others

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.