So which one should learn?My friend was telling me to learn C instaed of C++ because he says that C has more things in common with the other C languages, like C#,C++, etc, than C++ is this true? I am interested in learning how to write worms,and other complicated algorithoms, is C better at making these types of programs? Lastly can anyone point me to a good website from where to learn C or C++.

xTractatorix wrote:So which one should learn?My friend was telling me to learn C instaed of C++ because he says that C has more things in common with the other C languages, like C#,C++, etc, than C++ is this true? I am interested in learning how to write worms,and other complicated algorithoms, is C better at making these types of programs? Lastly can anyone point me to a good website from where to learn C or C++.

You're friend is an idiot. C++ is much closer to C#, Java, or any other modern OOP language than C is. And anyways, you can do write worms and algorithms in both C and C++, it's just a matter of preference. Oh, and look up K & R for anything C. Also, cplusplus.com works well.

shaqywacky wrote:I would suggest C++. C++ is essentially C with classes. They are so similar that C code will compile on a C++ compiler(but not the other way around). If you learn C++, you know C.

HAHA. Sorry. But if you know C++, you do not know C. They are extremely similar, and all C code is compatible with C++, but C++ code is not compatible with C (much like you pointed out). However, C++ introduces several easier methods of doing things that C just doesn't have. Generally, people learning C++ get very comfortable with these methods and never learn the C way (char array vs string, structs w/ function pointers vs classes, string concatenation, etc. ). Because of this, when many developers make the switch to C from C++, they have to relearn the entire language, essentially.

Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. -Rick Cook

HAHA. Sorry. But if you know C++, you do not know C. They are extremely similar, and all C code is compatible with C++, but C++ code is not compatible with C (much like you pointed out). However, C++ introduces several easier methods of doing things that C just doesn't have. Generally, people learning C++ get very comfortable with these methods and never learn the C way (char array vs string, structs w/ function pointers vs classes, string concatenation, etc. ). Because of this, when many developers make the switch to C from C++, they have to relearn the entire language, essentially.

So you've pointed out exactly what I said but then said it was wrong? Hmmm. As I said in my post, C++ is C with classes. The only differences you have pointed out are classes. If you LEARN C++ you should be very ready for C. I don't know what shit devs you are around but the ones at my work all learned C++ and can easily write C. I have never read a book or anything about C yet I have written many programs in C. And I honestly don't know how you would learn C++ without learning about c-style strings. If you didn't know how to use c-style strings, it should take you 5 minutes because you should already know about arrays, now add a null byte to the end.

I'm sure there are many differences between C and C++ beyond classes but to say that you know C++ but have to completely learn C after is ridiculous.

shaqywacky wrote:So you've pointed out exactly what I said but then said it was wrong? Hmmm. As I said in my post, C++ is C with classes. The only differences you have pointed out are classes. If you LEARN C++ you should be very ready for C. I don't know what shit devs you are around but the ones at my work all learned C++ and can easily write C. I have never read a book or anything about C yet I have written many programs in C. And I honestly don't know how you would learn C++ without learning about c-style strings. If you didn't know how to use c-style strings, it should take you 5 minutes because you should already know about arrays, now add a null byte to the end.

I'm sure there are many differences between C and C++ beyond classes but to say that you know C++ but have to completely learn C after is ridiculous.

I'm pretty sure I already pointed out the parts of my post that agreed with yours. But I also brought out more points than strings vs char arrays, none of which you countered. Also, to have to completely learn C after C++ may be an overstatement, but there are just a plethora of differences between the ways of doing things between the two programming languages. Granted, the syntax is almost exactly the same, once again, the ways of doing things are very much different.

Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. -Rick Cook

I did counter them, they were all examples of classes which I already said was the main difference between the two.

As for string concatenation, I'm not sure what you mean by this. I always used strcat() which is available in C and C++.

Whether some people forget or choose to not learn the parts of C++ that are similar to C in favor of using easier methods is irrelevant, those other parts still exist. C++ has many more libraries than C that make things easier but that doesn't mean the ways that don't use the libraries don't exist anymore.

You say the syntax is the same, and that's mainly what I was referring to. I was just noting that if he learned C++ he wouldn't need to learn a whole new syntax for C.

shaqywacky wrote:I did counter them, they were all examples of classes which I already said was the main difference between the two.

As for string concatenation, I'm not sure what you mean by this. I always used strcat() which is available in C and C++.

Whether some people forget or choose to not learn the parts of C++ that are similar to C in favor of using easier methods is irrelevant, those other parts still exist. C++ has many more libraries than C that make things easier but that doesn't mean the ways that don't use the libraries don't exist anymore.

You say the syntax is the same, and that's mainly what I was referring to. I was just noting that if he learned C++ he wouldn't need to learn a whole new syntax for C.

In general, people travel the path of least resistance. It's much easier in C++ to make a class, than it is to make enums/structs/struct function pointers and have to learn an entire new side to the language. So though those parts are still in C++, many C++ developers don't learn them, or if they do, aren't well versed in them. Because of this, they have to learn the "C-styled" way to do things which is quite different from the C++ way. So in general it's more difficult to learn C after initially learning C++, but then again this depends on the programmer. If you've always used the C way of doing things, while also using the OOP parts of C++, you've in essence learned them both.

Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. -Rick Cook