473,320 Members | 1,916 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Which to learn first C or C++?

Hello,
I'm currently attending a university majoring in Computer Science.
I took C and C++ at a community college and got an A in both
classes. That was three years ago. I have not programmed or
anything like that in three years. I want to get back into the
programming scene so I have a question: Which should I relearn
first, C or C++? I have forgotten a lot about both languages so
please tell me which i should relearn first!

Thanks!
--
--------------------------------- --- -- -
Posted with NewsLeecher v3.7 Final
Web @ http://www.newsleecher.com/?usenet
------------------- ----- ---- -- -

Oct 24 '06 #1
40 2932
dy****@hotmail.com a écrit :
Hello,
I'm currently attending a university majoring in Computer Science.
I took C and C++ at a community college and got an A in both
classes. That was three years ago. I have not programmed or
anything like that in three years. I want to get back into the
programming scene so I have a question: Which should I relearn
first, C or C++? I have forgotten a lot about both languages so
please tell me which i should relearn first!

Thanks!
--
--------------------------------- --- -- -
Posted with NewsLeecher v3.7 Final
Web @ http://www.newsleecher.com/?usenet
------------------- ----- ---- -- -
C++ ;-)
It's better.
And high level.
Well power for science.
;-)
Oct 24 '06 #2
C

"Nathan Brown" <dy****@hotmail.comwrote in message
news:45**********************@unlimited.newshostin g.com...
Hello,
I'm currently attending a university majoring in Computer Science.
I took C and C++ at a community college and got an A in both
classes. That was three years ago. I have not programmed or
anything like that in three years. I want to get back into the
programming scene so I have a question: Which should I relearn
first, C or C++? I have forgotten a lot about both languages so
please tell me which i should relearn first!

Thanks!
--
--------------------------------- --- -- -
Posted with NewsLeecher v3.7 Final
Web @ http://www.newsleecher.com/?usenet
------------------- ----- ---- -- -

Oct 24 '06 #3
On Oct 24, 4:13 pm, Nathan Brown (dyd...@hotmail.com) wrote:
<snip>
Which should I relearn
first, C or C++? I have forgotten a lot about both languages so
please tell me which i should relearn first!
I would say it's valuable to know both of them. I would go with C
first, C++ second. It is really dependent on what you want to program
for. If you want to do OS-level coding, C is the traditional choice
(or so I'm told). Neither language is inherently "better" than the
other, and they have their own uses. One thing I've noticed, though,
is that many (most?) books assume you have prior knowledge of C and
programming.

On a personal note, when I first decided to learn C++, I learned C
first. Then, when I tried to learn C++, I didn't like it. I'm not
really sure why, but I just preferred the C way of doing things, and I
expected C++ to be more C-like (as if it were a superset of the
language, which it really isn't), so I halted on my C++ progress. It
was only recently that I decided to get over myself and learn C++ (and
I like it now). I don't know if other people have experienced this,
but I just wanted to put it out there.

Oct 25 '06 #4
"Nathan Brown" <dy****@hotmail.comwrote in message
news:45**********************@unlimited.newshostin g.com...
Hello,
I'm currently attending a university majoring in Computer Science.
I took C and C++ at a community college and got an A in both
classes. That was three years ago. I have not programmed or
anything like that in three years. I want to get back into the
programming scene so I have a question: Which should I relearn
first, C or C++? I have forgotten a lot about both languages so
please tell me which i should relearn first!

Thanks!
It depends on your goal. If your goal is to get going quickly with
programmer, than relearning C will definately put you back coding faster.
But, C++ is really a different language, and I've found that it may be
better to learn C++ first than C so you don't have to unlearn some things
(using void pointers, etc..).

Oct 25 '06 #5
dy****@hotmail.com <Nathan Brownwrote:
>I'm currently attending a university majoring in Computer Science.
I took C and C++ at a community college and got an A in both
classes. That was three years ago. I have not programmed or
anything like that in three years. I want to get back into the
programming scene so I have a question: Which should I relearn
first, C or C++? I have forgotten a lot about both languages so
please tell me which i should relearn first!
It can't possibly take you more than a couple weeks to re-learn
C to the point where you have the entire language memorized.
So I would do this, just to get it out of the way. Since C
is a subset of C++, and is the subset in which most/all procedural
code is written, you need to know C thoroughly to learn C++.

Steve
Oct 25 '06 #6

Steve Pope wrote:
dy****@hotmail.com <Nathan Brownwrote:
I'm currently attending a university majoring in Computer Science.
I took C and C++ at a community college and got an A in both
classes. That was three years ago. I have not programmed or
anything like that in three years. I want to get back into the
programming scene so I have a question: Which should I relearn
first, C or C++? I have forgotten a lot about both languages so
please tell me which i should relearn first!

It can't possibly take you more than a couple weeks to re-learn
C to the point where you have the entire language memorized.
So I would do this, just to get it out of the way. Since C
is a subset of C++, and is the subset in which most/all procedural
code is written, you need to know C thoroughly to learn C++.

Steve
I respectfully disagree with that point of view. C is not a subset of
C++.
I also happen to believe that learning C++ before C is healthier.

In the case of the OP, since its a re-learn and not a
do_it_from_scratch operation, he could choose either path - or both. As
long as the C brain is working while coding in C and the C++ brain when
coding in C++.

Thats just a point of view, and not neccessarily the right one.
I'll say this: its very hard to undo C'isms from infecting C++ code.
Typically, the reverse is not true.

Oct 25 '06 #7
Steve Pope wrote:
It can't possibly take you more than a couple weeks to re-learn
C to the point where you have the entire language memorized.
There's a huge gap between 'memorized' and 'mastered'.
So I would do this, just to get it out of the way. Since C
is a subset of C++,
C is not a subset of C++. Lets see... reserved C++ keywords, void* not
being cast implicitly to other pointer types in C++, implicit
declarations of int returning functions in C, different semantics for
const objects, different rules for struct names and scope, character
litterals having type int in C and type char in C++, I could go on like
this...
you need to know C thoroughly to learn C++.
Not at all. C may actually be detrimental to your learning of C++ as it
may be necessary to unlearn things. For example, sane C++ developers
don't manipulate C-style char strings directly (except when interfacing
C code) and generally don't use the type unsafe mechanisms like void*
and varargs functions. You can usually judge how competent a C++
developper is just by looking at their use of C and C++ idioms.

Regards,
Bart.

Oct 25 '06 #8
I'm currently attending a university majoring in Computer Science.
I took C and C++ at a community college and got an A in both
classes. That was three years ago. I have not programmed or
anything like that in three years. I want to get back into the
programming scene so I have a question: Which should I relearn
first, C or C++? I have forgotten a lot about both languages so
please tell me which i should relearn first!
I started with C and then tried to program C++. My C++ was C with
classes. Horrible. If I were you, I'd start with C++ directly. Then
you don't learn bad C habbits that you have to get rid of later.
String handling for one thing.

Oct 25 '06 #9
Learn C first.

People give all kind of reasons why learning C++ first is better. But
as someone who has jsut got into C++ after finishing K&R a month ago,
let me put the case for C.

1. C++ books either teach you a basic "C with classes" or are
incomprehensible without an understanding of C. Knowing C makes them
easier.
2. The majority of online articles and tutorials assume knowledge of C.
3. C is small. After 8 hours of K&R you will be able to download the
Linux kernel, read its code and understand it. C++ takes a lot longer
- it is way way bigger.
4. C makes C++ possible. My first steps into C++ have been C programs
with STL string and vector thrown in. Almost against my will my code
is using classes just because it does make things easier.

Of course thsi is only my opinion - it may be that your previous C++
skills mean you will be uo and running in no time.

Patrick

Oct 25 '06 #10
pkirk25 wrote:
Learn C first.

People give all kind of reasons why learning C++ first is better. But
as someone who has jsut got into C++ after finishing K&R a month ago,
let me put the case for C.
After a month of C++ you feel competent enough to give advice?
1. C++ books either teach you a basic "C with classes" or are
incomprehensible without an understanding of C. Knowing C makes them
easier.
Those books are crap. Modern C++ beginner books exist, which teach C++
the right way from start.
2. The majority of online articles and tutorials assume knowledge of C.
Those tutorials are crap. There are modern C++ tutorials too.
3. C is small. After 8 hours of K&R you will be able to download the
Linux kernel, read its code and understand it. C++ takes a lot longer
- it is way way bigger.
That's curious. After 10 years of programming in C and doing my own
kernel development I still can't understand some parts of the Linux
kernel (*).

(*) "Understand" can obviously have many meanings. YMMV.
4. C makes C++ possible.
I'm not sure what you mean by that. C and C++ are distinct languages,
despite the common misconception that one is a subset of the other.

Regards,
Bart.

Oct 25 '06 #11
dy****@hotmail.com posted:
Which should I relearn first, C or C++? I have forgotten a lot about
both languages so please tell me which i should relearn first!

Here's how I look at it:

(1) C is a candle.

(2) C++ is a lightbulb.

Candles were invented far earlier, and had widespread usage all over the
world. Lightbulbs were invented much later, and are generally accepted to
be better -- i.e. better lumination and greater convenience.

So why would anyone use a candle today? Either:

(A) Electrical current is unavailable.

(B) They just genuinely like candles!

So, if we move from "candles & lightbulbs" to "C & C++", I list the reasons
for using C as follows. Either:

(A) A C++ compiler is unavailable.
(B) They just genuinely like C!

It's MUCH easier to get a C compiler for a particular platform than it is
to get a C++ compiler. Getting a C++ compiler for systems like Windows,
Linux, Playstation 2, is a simple task. But try getting a C++ compiler for
a tiny little microchip that goes in a blender -- you'll probably have to
code it in C.

C++ can do everything C can do, and more, so don't use C.

I myself am a C++ programmer. I keep a few candles around the house because
they might come in handy at some stage! Similarly, I have hung around
comp.lang.c to pick up some C skills, should it come it handy!

My advice: Learn C++ FULLSTOP. Don't bother with C -- it's about as useful
as learning to fix cars that were manufactured a century ago. When you've
achieved high proficiency in C++, you might decide to learn how to use C
aswell.

I think a programmer who can program in both C and C++ is a good thing -- I
myself aspire to it in anyway. The two compliment each other.

--

Frederick Gotham
Oct 25 '06 #12
dy****@hotmail.com wrote: <snip>
I want to get back into the programming scene so I have a question:
Which should I relearn first, C or C++?
There is nothing that can be done with C that can't be done with C++; there is
nothing that can be done with C++ that can't be done with C. Having said that,
there are a number of important modern programming techniques (object-oriented
programming, generic programming, even to a limited extent functional
programming) that are massively easier to do in C++, and also massively easier
to do well. (*)

On the other hand, C++ is a much, much bigger and more complex language than C:
unlike C, it's almost impossible to know it thoroughly. That's not necessarily a
bad thing; most people know a large enough subset of C++ for their needs, and do
perfectly well with it.

It's true that many books and tutorials on C++ assume a prior knowledge of C, or
at least of that (smallish) part of C++ which is very similar to C. (It's worth
knowing that even though this subset exists, and even though it would be
perfectly possible to write entirely C-style programs in C++, almost every
significantly big C++ program is constructed and written in an entirely
different idiom to a C one). I'd say in general though that these books tutorial
are inferior to those which don't take the start-with-C route (Someone with a
more detailed knowledge than mine of the C++ book world should be able to
recommend something); an awful lot of the postings for help you'll see on this
newsgroup, for instance, come from people using the start-with-C route who've
started bumping into "proper C++" - templates, standard containers, generic
algorithms, proper polymorphism - and become hopelessly lost.

My advice to you is to learn C++ - for almost all applications it's more
powerful than C - but to do it properly. What I mean by that is, learn from a
source which starts you off straight away with proper standard containers and
only mentions arrays in passing; which is absolutely pedantic about what is and
isn't allowed, and what will cause "undefined behaviour"; which never requires
you to write, say a linked list, except for one single exercise late on in the
section on pointers and arrays (which should be late on in the book)...

Hope that helps,
Tom

(*) Note to nitpickers and C++ gurus: I'm well aware that there are some rather
esoteric things in C++ - template metaprogramming for instance - that can't
reasonably be done in C; and some more that don't directly translate. But for
the purposes of day-to-day programming, and certainly beginner programming, I
think my statement is broadly true.
Oct 25 '06 #13
C++ is very powerful, but may be difficult to understand without prior
knowledge of C. Conceptually the biggest difference between the two is
OO programming, and generic programming. Both are topics that are not
explicitly tied to C++, but without knowledge of them you won't have
your C++ code fire on all possible cylinders.
However, C++ is a subset of C (even Bjarne describes it that way, and
he should know), which implies that it is definitely good to have
knowledge of C before tackling OOP and generics in C++.
The more you use C++, however, the more you begin to 'forget' about C
libraries, and use C++ libraries instead. But that is a conscious
choice then, and the understanding of the value of strong type safety
and other C++ benefits is better when you know the alternative.
dy****@hotmail.com wrote:
Hello,
I'm currently attending a university majoring in Computer Science.
I took C and C++ at a community college and got an A in both
classes. That was three years ago. I have not programmed or
anything like that in three years. I want to get back into the
programming scene so I have a question: Which should I relearn
first, C or C++? I have forgotten a lot about both languages so
please tell me which i should relearn first!

Thanks!
--
--------------------------------- --- -- -
Posted with NewsLeecher v3.7 Final
Web @ http://www.newsleecher.com/?usenet
------------------- ----- ---- -- -
Oct 25 '06 #14
IndyStef wrote:
However, C++ is a subset of C

Superset. C is a subset of C++.

Oct 25 '06 #15
Tom Smith wrote:
dy****@hotmail.com wrote: <snip>
There is nothing that can be done with C that can't be done with C++; there is
nothing that can be done with C++ that can't be done with C. Having said that,
there are a number of important modern programming techniques (object-oriented
programming, generic programming, even to a limited extent functional
programming) that are massively easier to do in C++, and also massively easier
to do well. (*)
here, you are right.
On the other hand, C++ is a much, much bigger and more complex language than C:
unlike C, it's almost impossible to know it thoroughly. That's not necessarily a
bad thing; most people know a large enough subset of C++ for their needs, and do
perfectly well with it.
yeah, C++ is much bigger & complex.

My advice to you is to learn C++ - for almost all applications it's more
powerful than C - but to do it properly. What I mean by that is, learn from a
source which starts you off straight away with proper standard containers and
only mentions arrays in passing; which is absolutely pedantic about what is and
isn't allowed, and what will cause "undefined behaviour"; which never requires
you to write, say a linked list, except for one single exercise late on in the
section on pointers and arrays (which should be late on in the book)...
hey... i know such a book, it is exactly like that you described. you
just have *put* my 4 months of experience with both C & C++ into
"words" here. well, i will unleash the mystery, the book, it is "C++
Primer 4/e", notice i said 4/e (not 3/e, 3/e is *utterly*
incomprehensible to persons without a good amount of programming
experience, so it is utterly incomprehensible to me :-(, C++ Primer 4/e
is not available in my country but 3/e is :-(

4/e teaches Modern C++,right from the beginning, (as a bouns it also
teaches how C++ interacts with hardware). i banged my head with its 3rd
chapter for 1 week (vectors & strings) & 1 more week for its 4th
chapter on pointers & arrays & trust me after learning about "vectors,
iterators & strings" "character arrays, free & malloc" were really like
a breeze :-) (still, i have seen some people, approx. 15-20%, who have
found C++ easier after learning C, contrary to the other 80-85% people
& me :-) who find C easier after C++. now, only you know where you
belong, you can check it by reading C++ Primer 4/e & C programming
Notes by Steve Summit, one of the "gems" of C community:
http://www.eskimo.com/~scs/cclass/cclass.html )
thanks
Hope that helps,
yeah, it helped me too (to understand my own experience)
>
Tom
arnuld ;-)

(*) Note to nitpickers and C++ gurus: I'm well aware that there are some rather
esoteric things in C++ - template metaprogramming for instance - that can't
reasonably be done in C; and some more that don't directly translate. But for
the purposes of day-to-day programming, and certainly beginner programming, I
think my statement is broadly true.
i understand that point

last advice:

1.) never, ever forget C++ FAQs & C FAQs. they are precious & much,
much correct & helpfull
2.) never, ever try to learn C++ or C from "online tutorials", all,
except Summit's, teach WRONG C & C++.
3.) also check, "Accelerated C++", i am saying so because, there is
*no* "ONE best book" for everyone. i have heard many praises for
"Accelerated C++".

http://arnuld.blogspot.com

Oct 25 '06 #16
Tom Smith wrote:
IndyStef wrote:
However, C++ is a subset of C


Superset. C is a subset of C++.
nope, C & C++ are different languages, they are really, very, very
different. my 4 months of experience with both of these langugaes has
convinced me enough to not to believe 90% of book authors (IFF, you
want to learn "Pure C++" a.k.a "Modern C++"). C was chosen as an
"inspiration" (as a "base") to create C++ & their "designs" & "ways"
of solving problems are completely different. at least this is what i
have found.

-- arnuld
http://arnuld.blogspot.com

Oct 25 '06 #17

IndyStef wrote:
The more you use C++, however, the more you begin to 'forget' about C
libraries, and use C++ libraries instead. But that is a conscious
choice then, and the understanding of the value of strong type safety
and other C++ benefits is better when you know the alternative.
Indy carries experience & he is right, as per my experience, as i am
doing the same thing he described here but i am doing it
unintentionally, implicitly.

thanks Indy

-- arnuld
http://arnuld.blogspot.com

Oct 25 '06 #18
Bart wrote:
People give all kind of reasons why learning C++ first is better. But
as someone who has jsut got into C++ after finishing K&R a month ago,
let me put the case for C.

After a month of C++ you feel competent enough to give advice?
In my case, my 4 months of experience is "exactly" contrary to my 1
month of experience.
1. C++ books either teach you a basic "C with classes" or are
incomprehensible without an understanding of C. Knowing C makes them
easier.

Those books are crap. Modern C++ beginner books exist, which teach C++
the right way from start.
YES, those are really *crap*. i know 3 'Modern C++" books:

1.) "C++ Primer" 4/e
2.) "Accelerated C++"
3.) "The C++ programming Language" by Bjarne Stroustrup (tough for a
beginner & very *dense*)
2. The majority of online articles and tutorials assume knowledge of C.

Those tutorials are crap. There are modern C++ tutorials too.
"online" tutorials are a BIG crap. (except of Steve Summit's)
4. C makes C++ possible.

I'm not sure what you mean by that. C and C++ are distinct languages,
despite the common misconception that one is a subset of the other.
it takes experience to understand & break-out of the "misconceptions".

so far, its my 3rd reply, all are explaining by themselves that
........... you already know what i will say :-)

Oct 25 '06 #19

Frederick Gotham wrote:
>
My advice: Learn C++ FULLSTOP. Don't bother with C -- it's about as useful
as learning to fix cars that were manufactured a century ago. When you've
achieved high proficiency in C++, you might decide to learn how to use C
aswell.
I cannot agree with that, not if you want to work in the practical
world, or at least in the world I work in.

Firstly, if you learn all of C++ then you are learning most of C too.
You cannot ignore arrays and char pointers because we now have vectors
and strings.

In the real world you are probably going to have to maintain legacy
code, written in C-style. In the real world you will have to work with
3rd party libraries with a C interface.

Now if you can tell me where the jobs are where I won't have to do
those things...
I think a programmer who can program in both C and C++ is a good thing -- I
myself aspire to it in anyway. The two compliment each other.
That seems rather strange, although they might complement each other.
C++ was designed to be backwardly compatible with C so that companies
could adopt it without throwing away all their existing and working C
code.

C is far more portable across libraries than C++. Thus many libraries
written in C++ have a C interface. (There are also many written in C
with a C++ wrapper interface. The ideal is written in C++ with a C
interface and then a C++ client wrapper on top of that. The client
wrapper should be all inlined code).

Oct 25 '06 #20
Bart <ba***********@gmail.comwrote:
>Steve Pope wrote:
>It can't possibly take you more than a couple weeks to re-learn
C to the point where you have the entire language memorized.
>There's a huge gap between 'memorized' and 'mastered'.
Sure, but the former is a prerequisite for the latter.
>So I would do this, just to get it out of the way. Since C
is a subset of C++,
>C is not a subset of C++. Lets see... reserved C++ keywords, void* not
being cast implicitly to other pointer types in C++, implicit
declarations of int returning functions in C, different semantics for
const objects, different rules for struct names and scope, character
litterals having type int in C and type char in C++, I could go on like
this...
It's a fairly limited list. But you're right, C isn't a true subset
of C++ due to this handful of necessary changes.
>you need to know C thoroughly to learn C++.
>Not at all. C may actually be detrimental to your learning of C++ as it
may be necessary to unlearn things.
I disagree. Most of the things that would need "unlearning" would
only seep in if you did lots of development in C, forcing you to
use C-style coding practices. Simply learning the language would
not be detrimental to C++, and in fact is pretty necessary.

Steve
Oct 25 '06 #21
Steve Pope <sp*****@speedymail.orgwrote:
Bart <ba***********@gmail.comwrote:
>>C is not a subset of C++. Lets see... reserved C++ keywords, void* not
being cast implicitly to other pointer types in C++, implicit
declarations of int returning functions in C, different semantics for
const objects, different rules for struct names and scope, character
litterals having type int in C and type char in C++, I could go on like
this...

It's a fairly limited list. But you're right, C isn't a true subset
of C++ due to this handful of necessary changes.
A fairly comprehensive list of the differences between C(99) and C++
(excluding the "incompatible C++ features") can be found at:

http://david.tribble.com/text/cdiffs.htm

though it seems it hasn't been updated for C++03 or later (the document
is dated 2001-08-05).

--
Marcus Kwok
Replace 'invalid' with 'net' to reply
Oct 25 '06 #22
Earl Purple wrote:
Frederick Gotham wrote:
>>
My advice: Learn C++ FULLSTOP. Don't bother with C -- it's about as
useful as learning to fix cars that were manufactured a century
ago.
When you've achieved high proficiency in C++, you might decide to
learn how to use C aswell.

I cannot agree with that, not if you want to work in the practical
world, or at least in the world I work in.

Firstly, if you learn all of C++ then you are learning most of C
too.
No, you need to learn the core language, but can happily ignore the
ugly parts of the C library. If you don't know anything about
vprintf/sscanf/malloc/strcpy/memcmp/strdup/etc, you will be a much
happier C++ user.

Why learn the difference between abs(), labs(), llabs(), fabs(),
fabsf(), and fabsl(), when std::abs() will do?
You cannot ignore arrays and char pointers because we now have
vectors
and strings.
No, but you can defer learning it as long as possible. In "Accelerated
C++" this appears (reluctantly) in chapter 10, long after learning
about iterators, string, vector, and writing your own classes and
template functions.
>
In the real world you are probably going to have to maintain legacy
code, written in C-style. In the real world you will have to work
with
3rd party libraries with a C interface.
But why start at the ugly end when trying to learn a language?
Using a lightbulb is hard, because you apparently will have to learn
"all this electricity stuff" first. Lighting a candle seems much
easier. It's not!
Bo Persson
Oct 25 '06 #23
Bo Persson wrote:

No, you need to learn the core language, but can happily ignore the
ugly parts of the C library. If you don't know anything about
vprintf/sscanf/malloc/strcpy/memcmp/strdup/etc

There is no C function called strdup().


Brian
Oct 25 '06 #24
Default User wrote:
Bo Persson wrote:

>No, you need to learn the core language, but can happily ignore the
ugly parts of the C library. If you don't know anything about
vprintf/sscanf/malloc/strcpy/memcmp/strdup/etc


There is no C function called strdup().
See how hard it is! :-)

There actually was one on the last C compiler I used. Non-standard I
bet.

Here is something you don't have to learn either, if you go directly
to C++:

In the functions strtod(), strtof(), strtok(), and strtol(), d stands
for double, f stands for float, and l stands for long. What does the k
stand for?
Bo Persson
Oct 25 '06 #25
In article <11**********************@h48g2000cwc.googlegroups .com>,
Cinder6 <ci*****@gmail.comwrote:
>On a personal note, when I first decided to learn C++, I learned C
first. Then, when I tried to learn C++, I didn't like it. I'm not
really sure why, but I just preferred the C way of doing things, and I
expected C++ to be more C-like (as if it were a superset of the
language, which it really isn't), so I halted on my C++ progress. It
was only recently that I decided to get over myself and learn C++ (and
I like it now). I don't know if other people have experienced this,
but I just wanted to put it out there.
This is often a syndrome found in many learning situations.
Basically you get comfy (purposefully or not) and habitual
in a certain something, and then anything different is seen
as suspect or wrong or too complex or too hard, etc. in some ways.
Of course, everything does not work this way.
--
Greg Comeau / 20 years of Comeauity! Intel Mac Port now in beta!
Comeau C/C++ ONLINE == http://www.comeaucomputing.com/tryitout
World Class Compilers: Breathtaking C++, Amazing C99, Fabulous C90.
Comeau C/C++ with Dinkumware's Libraries... Have you tried it?
Oct 25 '06 #26
Bo Persson wrote:
Default User wrote:
>There is no C function called strdup().

See how hard it is! :-)

There actually was one on the last C compiler I used. Non-standard I
bet.
It's not ISO standard, but it's POSIX standard.
Oct 25 '06 #27
In article <eh**********@blue.rahul.net>,
Steve Pope <sp*****@speedymail.orgwrote:
>dy****@hotmail.com <Nathan Brownwrote:
>>I'm currently attending a university majoring in Computer Science.
I took C and C++ at a community college and got an A in both
classes. That was three years ago. I have not programmed or
anything like that in three years. I want to get back into the
programming scene so I have a question: Which should I relearn
first, C or C++? I have forgotten a lot about both languages so
please tell me which i should relearn first!

It can't possibly take you more than a couple weeks to re-learn
C to the point where you have the entire language memorized.
The OP never learned C to the point where the OP had the entire
language memorized, "all they did" was take a C at a community college.
That said, few people can "memorize" C in a few weeks, in fact,
most can't, and instead it takes years. Somehow we're talking
about different things I would imagine.
>So I would do this, just to get it out of the way. Since C
is a subset of C++, and is the subset in which most/all procedural
code is written, you need to know C thoroughly to learn C++.
That's true to some extent, but not the whole picture.
Counterarguments on a number of aspects can be made for each.
--
Greg Comeau / 20 years of Comeauity! Intel Mac Port now in beta!
Comeau C/C++ ONLINE == http://www.comeaucomputing.com/tryitout
World Class Compilers: Breathtaking C++, Amazing C99, Fabulous C90.
Comeau C/C++ with Dinkumware's Libraries... Have you tried it?
Oct 25 '06 #28
Earl Purple posted:
Firstly, if you learn all of C++ then you are learning most of C too.
You cannot ignore arrays and char pointers because we now have vectors
and strings.

I never said that. Arrys and char pointers are fully-fledged features of
C++.

In the real world you are probably going to have to maintain legacy
code, written in C-style. In the real world you will have to work with
3rd party libraries with a C interface.

If you are proficient in C++, you should be able to read C-style code
because you won't see any features that you've never seen before.

That seems rather strange, although they might complement each other.
C++ was designed to be backwardly compatible with C so that companies
could adopt it without throwing away all their existing and working C
code.
The compliment each other because:

(1) You know C++, a great language for doing all sorts of stuff.
(2) You know C, so you can write for tiny little microchips aswell.

--

Frederick Gotham
Oct 25 '06 #29
Bo Persson posted:
Using a lightbulb is hard, because you apparently will have to learn
"all this electricity stuff" first.

I just flick a switch.

--

Frederick Gotham
Oct 25 '06 #30
Gernot Frisch wrote:
>>I'm currently attending a university majoring in Computer Science.
I took C and C++ at a community college and got an A in both
classes. That was three years ago. I have not programmed or
anything like that in three years. I want to get back into the
programming scene so I have a question: Which should I relearn
first, C or C++? I have forgotten a lot about both languages so
please tell me which i should relearn first!


I started with C and then tried to program C++. My C++ was C with
classes. Horrible. If I were you, I'd start with C++ directly. Then
you don't learn bad C habbits that you have to get rid of later.
String handling for one thing.
Agreed, I took a long time to get over 10 years of C and start thinking
about problems in a C++ way and that was in the days when C++ was little
more than C with classes.

What's more important than the feature differences between the two
languages is the mindset required to work in them. Learn C++ first and
learn to think as a C++ developer. The only drawback to this is you
will find pure C frustrating!

--
Ian Collins.
Oct 25 '06 #31
In article <11**********************@e3g2000cwe.googlegroups. com>,
pkirk25 <pk****@kirks.netwrote:
>Learn C first.

People give all kind of reasons why learning C++ first is better. But
as someone who has jsut got into C++ after finishing K&R a month ago,
let me put the case for C.

1. C++ books either teach you a basic "C with classes" or are
incomprehensible without an understanding of C. Knowing C makes them
easier.
This comment is not pro or con, but to point out that
perhaps if that is the case that you are using the wrong C++ texts.
>3. C is small. After 8 hours of K&R you will be able to download the
Linux kernel, read its code and understand it. C++ takes a lot longer
- it is way way bigger.
C++ is larger, but it is certainly not the case that most people
could read the LINUX kernel with only 8 hours of use of K&R.
>4. C makes C++ possible. My first steps into C++ have been C programs
with STL string and vector thrown in. Almost against my will my code
is using classes just because it does make things easier.
But "equally" using things like C++ strings makes C easier :)
--
Greg Comeau / 20 years of Comeauity! Intel Mac Port now in beta!
Comeau C/C++ ONLINE == http://www.comeaucomputing.com/tryitout
World Class Compilers: Breathtaking C++, Amazing C99, Fabulous C90.
Comeau C/C++ with Dinkumware's Libraries... Have you tried it?
Oct 25 '06 #32
In article <11**********************@m73g2000cwd.googlegroups .com>,
IndyStef <ok*******@hurco.comwrote:
>C++ is very powerful, but may be difficult to understand without prior
knowledge of C.
One doesn't learn a whole language en masse, but instead in parts.
Therefore, whether one learns C or C++ you're going to learn a subset
of either. That subset should be reasonable for either choice of
language.
>Conceptually the biggest difference between the two is
OO programming, and generic programming. Both are topics that are not
explicitly tied to C++, but without knowledge of them you won't have
your C++ code fire on all possible cylinders.
Ok, so let's say this: programming is not equal to just learning
some language.
>However, C++ is a subset of C (even Bjarne describes it that way, and
he should know), which implies that it is definitely good to have
knowledge of C before tackling OOP and generics in C++.
The more you use C++, however, the more you begin to 'forget' about C
libraries, and use C++ libraries instead. But that is a conscious
choice then, and the understanding of the value of strong type safety
and other C++ benefits is better when you know the alternative.
You probably meant the other way around, or that C++ is a superset
of C. Anyway, it's worth pointing out that some folks differ on this.
--
Greg Comeau / 20 years of Comeauity! Intel Mac Port now in beta!
Comeau C/C++ ONLINE == http://www.comeaucomputing.com/tryitout
World Class Compilers: Breathtaking C++, Amazing C99, Fabulous C90.
Comeau C/C++ with Dinkumware's Libraries... Have you tried it?
Oct 25 '06 #33
In article <11**********************@e3g2000cwe.googlegroups. com>,
arnuld <ar*****@gmail.comwrote:
>Tom Smith wrote:
>IndyStef wrote:
However, C++ is a subset of C


Superset. C is a subset of C++.

nope, C & C++ are different languages, they are really, very, very
different. my 4 months of experience with both of these langugaes has
convinced me enough to not to believe 90% of book authors (IFF, you
want to learn "Pure C++" a.k.a "Modern C++"). C was chosen as an
"inspiration" (as a "base") to create C++ & their "designs" & "ways"
of solving problems are completely different. at least this is what i
have found.
C is more than just inspiration for C++, as C++ is literally
built upon it, but yes, at some point, that does mean differences
of various natures materialize.
--
Greg Comeau / 20 years of Comeauity! Intel Mac Port now in beta!
Comeau C/C++ ONLINE == http://www.comeaucomputing.com/tryitout
World Class Compilers: Breathtaking C++, Amazing C99, Fabulous C90.
Comeau C/C++ with Dinkumware's Libraries... Have you tried it?
Oct 25 '06 #34
Greg Comeau wrote:
In article <11**********************@e3g2000cwe.googlegroups. com>,
arnuld <ar*****@gmail.comwrote:
Tom Smith wrote:
IndyStef wrote:
However, C++ is a subset of C
>
>
Superset. C is a subset of C++.
nope, C & C++ are different languages, they are really, very, very
different. my 4 months of experience with both of these langugaes
has convinced me enough to not to believe 90% of book authors (IFF,
you want to learn "Pure C++" a.k.a "Modern C++"). C was chosen as an
"inspiration" (as a "base") to create C++ & their "designs" &
"ways" of solving problems are completely different. at least this
is what i have found.

C is more than just inspiration for C++, as C++ is literally
built upon it, but yes, at some point, that does mean differences
of various natures materialize.
I think "approximate subset" or something like that to describe C is
OK. Right now, the differences between C99 and C++ are somewhat greater
than between c90 and C++, but still you can write a very large set of
programs that are syntactically and semantically identical in either
language, although you may need some some less than optimal constructs.

Brian
Oct 25 '06 #35
In article <Ea*******************@news.indigo.ie>,
Frederick Gotham <fg*******@SPAM.comwrote:
>If you are proficient in C++, you should be able to read C-style code
because you won't see any features that you've never seen before.
This assumes C90, not C99.
--
Greg Comeau / 20 years of Comeauity! Intel Mac Port now in beta!
Comeau C/C++ ONLINE == http://www.comeaucomputing.com/tryitout
World Class Compilers: Breathtaking C++, Amazing C99, Fabulous C90.
Comeau C/C++ with Dinkumware's Libraries... Have you tried it?
Oct 26 '06 #36
Thanks for all the responses guys...thanks a lot!
--
--------------------------------- --- -- -
Posted with NewsLeecher v3.7 Final
Web @ http://www.newsleecher.com/?usenet
------------------- ----- ---- -- -

Oct 26 '06 #37
What's more important than the feature differences between the two
languages is the mindset required to work in them. Learn C++ first
and
learn to think as a C++ developer. The only drawback to this is you
will find pure C frustrating!
Well, I use C for Microprocessors, and these programs usally are so
small that C is not really frustrating. VisualBasic would be ;)
Oct 26 '06 #38

Bo Persson wrote:
Earl Purple wrote:
Frederick Gotham wrote:
>
My advice: Learn C++ FULLSTOP. Don't bother with C -- it's about as
useful as learning to fix cars that were manufactured a century
ago.
When you've achieved high proficiency in C++, you might decide to
learn how to use C aswell.
<snip stuff>

I never said that you had to learn C first, I said that you can't not
learn C at all and learn only C++ (as what I quoted above).
>
No, but you can defer learning it as long as possible. In "Accelerated
C++" this appears (reluctantly) in chapter 10, long after learning
about iterators, string, vector, and writing your own classes and
template functions.
I have not read Accelerated C++ nor would it be possible for me to
judge any C++ book for beginners by reading it now because I know the
language already. The best person to judge a book that teaches a
language is someone who doesn't know how to program at all. Someone who
finds the concept of a for-loop complicated and has to be explained the
concepts of parameter passing by value and by reference (whatever means
you use for "by reference").
In the real world you are probably going to have to maintain legacy
code, written in C-style. In the real world you will have to work
with
3rd party libraries with a C interface.

But why start at the ugly end when trying to learn a language?
Actually if I were really going to teach people C++ I would try to
create a whole framework with a cool GUI (possibly written in another
language) and they would be writing libraries.

One thing I have pretty much never used in my whole C++ programming
career is cin. Console apps look like they belong 20 years ago and even
then there is no way to intercept the key presses so when you ask them
to enter a number, you can't "ignore" invalid key presses. Now give
them their first Java course or C# under .NET and they'll think "cool -
cutting edge technology". C++ has to be taught for its strengths, i.e.
writing libraries or processes that run in the background.

Yet every C++ beginner I have encountered is writing console apps and
struggling with cin.
Using a lightbulb is hard, because you apparently will have to learn
"all this electricity stuff" first. Lighting a candle seems much
easier. It's not!
And to the one who said "turn on the switch", that is what you want to
do. Teach them to make different types of lamps and then plug it in to
the existing technology. Make it look cool and modern and you'll get an
interest.

Oct 26 '06 #39
Earl Purple posted:
I never said that you had to learn C first, I said that you can't not
learn C at all and learn only C++ (as what I quoted above).

Over 95% of people use C++ perfectly well without having programmed in C.

Yet every C++ beginner I have encountered is writing console apps and
struggling with cin.

That's because you can test out algorithms real easily with console
applications.

--

Frederick Gotham
Oct 27 '06 #40

Frederick Gotham wrote:
Earl Purple posted:
I never said that you had to learn C first, I said that you can't not
learn C at all and learn only C++ (as what I quoted above).


Over 95% of people use C++ perfectly well without having programmed in C.
Over 95% of people don't program in anything. 95% of C++ programmers do
not use C++ perfectly well, and most of them will know some C too, and
if they haven't programmed in it, they will probably have used a 3rd
party C library at some point.
Yet every C++ beginner I have encountered is writing console apps and
struggling with cin.

That's because you can test out algorithms real easily with console applications.
Yes but you rarely need to use cin.

Oct 27 '06 #41

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

17
by: Rob | last post by:
i know javascript, vbscript, asp css and alot more and im only 14 i was wondering which is easier to learn php or cgi. any help?
38
by: BORT | last post by:
Please forgive me if this is TOO newbie-ish. I am toying with the idea of teaching my ten year old a little about programming. I started my search with something like "best FREE programming...
55
by: Elijah | last post by:
I have read many of the topics on learning C++ or Java first. It seems like everyone says something different. I would like to know if I should learn C++ or Java. First a little about myself. I...
21
by: TAM | last post by:
Hi, I read that ASP.NET uses VB.NET instead of VBScript. I also read that ASP.NET is a subset of VB.NET. So if I learn VB.NET first then do I have the knowledge for programming ASP.NET...
17
by: clintonG | last post by:
I'm using an .aspx tool I found at but as nice as the interface is I think I need to consider using others. Some can generate C# I understand. Your preferences please... <%= Clinton Gallagher ...
7
by: felecha | last post by:
I have been developing an app in VB.Net, using a simple form and a button to kick off a class that starts asynchronously receiving from a MessageQueue. It's been working fine, but now I'm moving...
9
by: arnuld | last post by:
hai folks, well, it's me again and again, i am asking questions. anyway, with your help i have finalised that i will start learning c++ (as you told me that i do not need to know any OO language...
1
by: dydx13 | last post by:
Hello, i have a quick question: Should I learn C first or should I learn C++ first? Does it matter? Thanks! -- --------------------------------- --- -- - Posted with NewsLeecher v3.7...
12
by: Srdja123 | last post by:
Like the topic says, I want to learn a language, but which should I learn? Which language will be mostly used in the future? C++ or C#?
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.