Well I want to learn C...

linkgoron

Platinum Member
Mar 9, 2005
2,598
1,238
136
Well, I know old/er languages and thought that C is something I'd like to learn... Can you guys give me links to some good sites? I know some Pascal and some Java and really a bit of VB, so do you think C is a good start (then I guess I'll move to C++?)
Oh can you guys give me a link to a free and good compiler?
EDIT:
Should I learn C before starting C++?
 

EagleKeeper

Discussion Club Moderator<br>Elite Member
Staff member
Oct 30, 2000
42,589
5
0
Run a search for such information.

Many previous threads have adressed this topic.
 

icelazer

Senior member
Dec 17, 1999
323
0
71
Kernighan and Ritchie is the definitive C book. It might help to learn c++ first..it's easier to learn OO and a superset of C. From there, learning c is just restricting yourself to using a subset of C++ and using a few different c functions (printf instead of cout, etc).
 

EagleKeeper

Discussion Club Moderator<br>Elite Member
Staff member
Oct 30, 2000
42,589
5
0
Originally posted by: icelazer
Kernighan and Ritchie is the definitive C book. It might help to learn c++ first..it's easier to learn OO and a superset of C. From there, learning c is just restricting yourself to using a subset of C++ and using a few different c functions (printf instead of cout, etc).

Learning C++ could prevent you from having a better understanding of how C works and also hide from you some of the problems that can bite you with poor design.

 

Stuxnet

Diamond Member
Jun 16, 2005
8,392
1
0
It's tough to say which you should learn first... it depends no your long-term goals. Unless you have a definitive need for C, I would learn C++ and forget C for now.

JMO
 

Thyme

Platinum Member
Nov 30, 2000
2,330
0
0
If you want to really *learn* the language and not just how to use it to do a few things, learning C first would be a good investment. It won't take you long.
 

Ryland

Platinum Member
Aug 9, 2001
2,810
13
81
Originally posted by: Thyme
If you want to really *learn* the language and not just how to use it to do a few things, learning C first would be a good investment. It won't take you long.

I second the "learn C first". It is very easy to shoot yourself in the foot with C/C++ but if you learn C first you should be able to figure out what NOT to do whereas C++ hides some of it from the programmer.
 

EagleKeeper

Discussion Club Moderator<br>Elite Member
Staff member
Oct 30, 2000
42,589
5
0
Much more embedded real work is done in C vs C++.

Trying to convert from C++ to C for embedded could be a royal pain to unlearn ideas.
 

xtknight

Elite Member
Oct 15, 2004
12,974
0
71
C++ will immensely confuse you if you don't learn C first, especially when you need to troubleshoot.
 

linkgoron

Platinum Member
Mar 9, 2005
2,598
1,238
136
Thanks guys! Well, I don't think I'll find books where I live, so can you guys give me any links to good sites and a free compiler?
 

EagleKeeper

Discussion Club Moderator<br>Elite Member
Staff member
Oct 30, 2000
42,589
5
0
Originally posted by: linkgoron
Thanks guys! Well, I don't think I'll find books where I live, so can you guys give me any links to good sites and a free compiler?

See my first post in this thread.

Also, you can usually find K&R online via Amazon, etc.

 

linkgoron

Platinum Member
Mar 9, 2005
2,598
1,238
136
Originally posted by: EagleKeeper
Originally posted by: linkgoron
Thanks guys! Well, I don't think I'll find books where I live, so can you guys give me any links to good sites and a free compiler?

See my first post in this thread.

Also, you can usually find K&R online via Amazon, etc.

I looked around bt couldn't find any topics... Only "help me here" and stuff.. So that site is a C++ site, are there any good C sites?
 

homercles337

Diamond Member
Dec 29, 2004
6,340
3
71
Originally posted by: linkgoron
Thanks guys! Well, I don't think I'll find books where I live, so can you guys give me any links to good sites and a free compiler?

Google for Bloodshed. Best free IDE out there.
 

linkgoron

Platinum Member
Mar 9, 2005
2,598
1,238
136
Originally posted by: homercles337
Originally posted by: linkgoron
Thanks guys! Well, I don't think I'll find books where I live, so can you guys give me any links to good sites and a free compiler?

Google for Bloodshed. Best free IDE out there.

OK I'll try it, is Cprogramming.com a good C/C++ site?
BTW, what does DEV-C++ mean, and I can use it for both C and C++?
 

Sureshot324

Diamond Member
Feb 4, 2003
3,370
0
71
Since you already know Java it would probably be easier to transition to C++ since you're already used to OO programming. If you port a Java program to C++ the structure of your code stays the same, but if you port to C it's completely different since you don't have classes.

I don't agree that you'll get bad habits from learning one before the other.
 

bersl2

Golden Member
Aug 2, 2004
1,617
0
0
Originally posted by: whitecloak
Kernighan & Ritchie

Make sure to get the second edition, which was updated for the ANSI standard. Try not to use the old K&R syntax.

Other than that, the book is the definitive reference. You might want to use another source for learning, but always reconcile with K&R.
 

kevinthenerd

Platinum Member
Jun 27, 2002
2,908
0
76
http://en.wikipedia.org/wiki/C_programming#Memory_allocation

I started with C++ and had a hell of a time with C afterwards. I'm too much of a BASIC guy to make an informed decision for you on that one.

I do have one tip for you, though. Comment the ends of your curly braces.

foo {
bar;
} // foo

When you get a long tree of them going, you'll forget what you're ending. In BASIC, I always put the variable names on the ends of my For loops to make the code easier to edit months later.

For x = 1 to 10
Print "Hello world!"
Next x


If you know Java, you'll find C++ to be the easiest choice.