Is C really that hard to learn?

For everything that's not in any way related to PureBasic. General chat etc...
merihevonen
Enthusiast
Enthusiast
Posts: 326
Joined: Mon Jan 01, 2007 7:20 pm

Is C really that hard to learn?

Post by merihevonen »

Hello!

I have always been doing some stuff in PureBasic, Python and some Perl too... So I was wondering if C is hard to learn... Why I am asking this, is because most of the outstanding projects have been written in C.. here are some to name:

Linux Kernel by Linus Torvalds
VST Technology by Steinberg
Need for Speed: Most Wanted [PC Version] (Don't know of Carbon, but Most Wanted is written in C++..) by EA Games

Many might know the Linux kernel.. but for those who don't know, it is the "heart" of an Linux Operating System. The kernel itself isn't the OS, note that! THe Linux distributions, like Debian, Ubuntu, SUSE, Mandriva, etc.. build the rest of the body, whilst the most important part of it is the heart ofcourse, and that is the Linux kernel.

The VST Technology (Virtual Studio Technology) is a Software Synth/Effect Plugin API for music creation applications like FL Studio, Cubase, etc.. Have you heard some cool TB303 sounds in some modern Trance/Techno tunes? That is most likely done with a TB303 VST Plugin :P

I guess you all know the last one.. yeah it's that uber-cool racing game form Electronic Arts.. I got to knew that NFSMW was written in C++ in an IRC channel.. I guess it was called #ea but I don't remember on which server it was..

-------------------------------------------------------------

So if anyone would be so kind to give me some tutorial pages about C, I would appreciate it a lot! The main parts I would like to study is basic parameter handling, basic Input-Output stuff and advanced GUI creation..

Thanks a million times!!
Nik
Addict
Addict
Posts: 1017
Joined: Fri May 13, 2005 11:45 pm
Location: Germany
Contact:

Post by Nik »

You forgot about OpenOffice, gtk+ , KDE(C++), Firefox, and even most parts of Windows and many more.
I too lean C++, and I think it's not realy the language taht is hard but the way you develop in it. You need to lean about much more major compilers, Makefiles or use full blown IDEs. It's also a little bit more complicated to choose from the many available Librabries. because ther is nothing like a common way, there are however many Common ways, there is pure WinAPI and MFC on Windows, POSIX, GTK and KDE on Linux and so on. I use c++ to develop Server software as a learning project. Since this software runs on the commandlien only I only need POSIX and MySQL for it. This makes things very portabe as well. My test client for example (plain POSIX) currently runs on Linux x86, Mac OS X x86, Mac OS X ppc and NetBSD UltraSparc and that is only the systems I could use to test...

btw: PureBasic is written in C aswell
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post by Trond »

Don't use MFC.
techjunkie
Addict
Addict
Posts: 1126
Joined: Wed Oct 15, 2003 12:40 am
Location: Sweden
Contact:

Post by techjunkie »

To learn (pure) C, you need just one book - it's outstanding!
Image
http://cm.bell-labs.com/cm/cs/cbook/
and to learn (pure) C++, this one!
Image
(Dennis M. Ritchie RULES!)
Image
(\__/)
(='.'=) This is Bunny. Copy and paste Bunny into your
(")_(") signature to help him gain world domination.
Kale
PureBasic Expert
PureBasic Expert
Posts: 3000
Joined: Fri Apr 25, 2003 6:03 pm
Location: Lincoln, UK
Contact:

Post by Kale »

I learned C and C++ years ago and found them very easy because (to be honest) there aren't many keywords to learn. The only trouble is that there are some very unusual ways of using these few keywords and operators to achieve advanced functionality. This is actually why i don't use it.

I read a few books on C++ and basically thought woohoo that's that sorted lets download some code off the net and have a play. Imagine my surprise when i couldn't make head or tail of that code! Couple this with the fact that there are alot of bad C/++ programmers out there that don't care about code formatting and comments and you are in a world of hurt.

Simple C/++ is easy. The more advanced stuff is like a massive puzzle that never makes sense.

I've now switched to C# and it is fantastic. Yes, ok, it needs the .NET runtime but C needs the C runtime library. Both are now part of the OS.

C# is clean, easy to understand, well documented and forces good programming practises. Visual Studio 2005 is also the greatest IDE you will ever use. I truely believe it's the one thing Microsoft has ever got right. :wink:

This is the best book i've read on C# and thoroughly recommend it:

Image

http://www.apress.com/book/bookDisplay.html?bID=390
--Kale

Image
User avatar
Kaeru Gaman
Addict
Addict
Posts: 4826
Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany

Post by Kaeru Gaman »

...there are some very unusual ways of using these few keywords and operators to achieve advanced functionality.
wich is actually the real power of C.
you can use C as any other language, or you can take advantage of what makes C unique.
of course noone could use every trick on instant, but with the time you can get used to the philosophy.

I think the approach - how you learn it - makes a big difference.
as Kale said, there are a lot of bad programmers out there, and even codes from good ones are hard to understand.
better take some books and some tutorials and learn it step by step first.
looking into other's code is only useful if you reached an advanced level.
(look into the sources of the PBOSL. could you read it like a comic? no? understood? ;) )
...there aren't many keywords to learn.
just imagine, PB would consist of only those keywords you find on the left of the Help's content-table.
only loops, if, select/case and some other.
imagine, all LIBs on the right side of the table were LIBs you have to include manually.
also count every UserLib and the complete PBOSL and the CodeArchive as avaliable LIBs.
this will give you some picture of how C is.

- C itself isn't hard to learn
- to make use of the possible tricks is learning of some new philosophy
- to know much avaliable libraries and make correct use of them is a lot of work

-----------------------------------------------
... but C needs the C runtime library.
Egypt...? :?:
Both are now part of the OS.
wich OS....
I don't get these two statements resp. I doubt them...
oh... and have a nice day.
thefool
Always Here
Always Here
Posts: 5875
Joined: Sat Aug 30, 2003 5:58 pm
Location: Denmark

Post by thefool »

I would like to comment Kale's choice for a book, yes its good. Im not done at all with it, but so far its one of the best i have read. And its quite fast and no-nonsense. Worth every penny :)
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

I quite like c, even though I'm no expert with it. It is very easy to learn as there are so few keywords (as already pointed out). I find a good knowledge of asm helps a lot since the build process is very similar etc. It's good stuff! Better than that VB crap! C++, on the other hand, is a fire breathing, s*it shovelling monster! It does my head in! Way way too many obscurities with the oop bolted on like some dodgy house extension!

I must admit that when I eventually look at .Net in any meaningful way (which is inevitable I guess) then it will be C# rather than VB.Net. No question!
I may look like a mule, but I'm not a complete ass.
merihevonen
Enthusiast
Enthusiast
Posts: 326
Joined: Mon Jan 01, 2007 7:20 pm

Post by merihevonen »

Thanks for every recommendation!
I will see if I can get one of these books through Amazon.com...
So it isn't very hard, right?

If it isn't much asked, could someone give me a very very simple "Hello World" dialog written in C? If possible, using GTK+ or wxWidgets (I love this one!)

Thanks!
dracflamloc
Addict
Addict
Posts: 1648
Joined: Mon Sep 20, 2004 3:52 pm
Contact:

Post by dracflamloc »

One problem with C#: Its slow as dirt. Not as slow as Java, but its pretty bad in big projects or intense processing.

I think C is great and use it a lot. Theres one thing you are gonna miss bigtime when moving to C, and that is the PB libraries. They really make things a lot faster to develop and thats why I still do some apps in PB.

You should also check out the D programming language. It's kind of a hybrid between java and C++, but can be used like C. It has a garbage collector like C# or Java, however its natively compiled so the speed lies somewhere between C and C#/Java. Plus its open-source (GDC)
merihevonen
Enthusiast
Enthusiast
Posts: 326
Joined: Mon Jan 01, 2007 7:20 pm

Post by merihevonen »

I think I understood everything:

C# - "Slow"
C - Good
C++ - Shit

But I think that some people have jumped over some things that I asked here earlier:
So if anyone would be so kind to give me some tutorial pages about C, I would appreciate it a lot! The main parts I would like to study is basic parameter handling, basic Input-Output stuff and advanced GUI creation..
And:
If it isn't much asked, could someone give me a very very simple "Hello World" dialog written in C? If possible, using GTK+ or wxWidgets (I love this one!)
User avatar
Kaeru Gaman
Addict
Addict
Posts: 4826
Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany

Post by Kaeru Gaman »

merihevonen wrote:C# - "Slow"
C - Good
C++ - Shit
:lol:
the difference in C and C++ is mainly the possibility of OOP in C++
if you don't make use of it, you're actually programming C, no matter you use a C++ compiler....
oh... and have a nice day.
Tipperton
Addict
Addict
Posts: 1286
Joined: Thu Jun 19, 2003 7:55 pm

Post by Tipperton »

C is a lot like Chess....

Fairly easy to learn, difficult to master, especially pointers (they were always my biggest problem).
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

@merihevonen, there are more c tutorials scattered around the net than porn sites. Just do a Google search.
I may look like a mule, but I'm not a complete ass.
Kale
PureBasic Expert
PureBasic Expert
Posts: 3000
Joined: Fri Apr 25, 2003 6:03 pm
Location: Lincoln, UK
Contact:

Post by Kale »

Kaeru Gaman wrote:I don't get these two statements resp. I doubt them...
See:
crtdll.dll
msvcrt.dll
--Kale

Image
Post Reply