As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
If this question can be reworded to fit the rules in the help center, please edit the question.

9

Given the number of C questions I've seen in just the last few weeks tagged C++ I'd say it was a pretty important question.
–
Steven BurnapJun 10 '12 at 20:15

12

Judging by how often I see "C/C++", I'd say it's very common.
–
user16764Jun 10 '12 at 20:15

9 Answers
9

If the questions was phrased like "Do you know the difference between C and C++?" and you were allowed to just respond with "Yes" then I could see your confusion, but if they were actually asking "What -are- the differences between C and C++?" and a more open-ended answer was expected, I can see it as a legitimate "avenue of inquiry" as they say.

For example, only having ever coded in C and never in C++, I would barely be able to answer beyond a vague "C++ supports object oriented coding?".

This was going to pretty much be my answer. Having interviewed people for programming positions, I can tell you asking the obvious questions will cut out a good number of candidates very easily.
–
TyannaJun 10 '12 at 22:56

A million upvotes for you. I'm alawys amazed at the beginner level questions so many interviewees cannot answer.
–
HLGEMJun 12 '12 at 17:10

1

Then again, I've been programming for over 25 years and there are some beginner-level questions I can't really answer anymore (gets worse if you ask for definitions). I was looking at the article linked in this answer and I was like "hmmm yeah let me think about that for a minute", whereas at work I work on implementing rather complex systems and generally don't have much trouble coming up with solutions. Some of those little questions scare me more than a multi-tiered system and throwing in some multithreaded functionality, crap like that... Weird, I know.
–
MetalMikesterJun 12 '12 at 17:39

indeed. As discussed on another P.SE thread, for interviews I've gotten into the habit of starting with ridiculously obvious questions ("how do you declare a variable in JS?", "how many bytes for 1 int in Java?", "what's a pointer?" etc...). I don't mind a first error (stress is a factor, even if I start interviews with conversations to relax them), but usually if I can get 3 strikes before reaching decent questions, then I consider it perfectly acceptable to hang up without going further or kick them out. The 5 minutes it takes to ask the stupid questions is worth the time saved.
–
haylemJun 13 '12 at 4:14

3

In fact, I even apologize before asking these first questions, as I don't want skilled applicants to be weirded out by them, or think I'm not taking them seriously and to feel like they wouldn't belong here.
–
haylemJun 13 '12 at 4:16

I think that young programmers freshly out of technical school (or where they learn their skills from) simply do not learn older languages such as C, C++, Lisp, OCaml, etc. They simply come out as "c# programmers" or "java programmers", etc. And when they find a job, they do not challenge themselves with learning other languages.

Of course there are some that do, but from those I have worked with, there is a general tendency for the younger programmers to follow this pattern.

Disclaimer: Since I am talking about education, then there can of course be differences from country to country about what is being emphasized in the education.

What universities are you talking about? "Arcane" languages? I had to learn assembly for MIPS at the university of Rome...
–
Vitalij ZadneprovskijJun 11 '12 at 7:23

Generally, the "young" programmers I have met have had a degree in engineering. Come to think of it, almost all the programmers I work with have a degree in engineering, including myself.
–
PeteJun 11 '12 at 7:49

1

C and C++ are still taught in school. The problem is most of the time the same compiler is used to teach both. This means they never actually learn the differences between the two languages.
–
RamhoundJun 11 '12 at 12:40

@Pete If I came out as a 'C# programmer' I can't imagine going to learn C or C++ as 'another language'. Surely I'd like Ruby, Haskell, Javascript, Python. C-family languages are close enough that knowing one is enough.
–
Kirk BroadhurstJun 12 '12 at 23:20

There's a whole bunch of them. There's an infinity of people who have idiot lecturers who teach C-strings and new and delete, or out-of-date tutorials or bad books, who learn "C++" but actually C, who think the two are pretty close.

Of course, if you're an employer, then saying that they're the same or even similar is a big warning light.

This brings up a very good point. It is acceptable and perhaps even common to teach C but use the C++ compiler. This of course leads to confusions by students who never learn the major differences betwen C and C++. I am only talking about the major differences between the same revision.
–
RamhoundJun 11 '12 at 12:39

4

@Ramhound: It's not acceptable at all. The fact that it's common is orthogonal.
–
DeadMGJun 11 '12 at 20:13

1

The sad fact is that C and C++ are almost universally taught badly. Go to SO and look through the C and C++ tags, and you'll see the same misconceptions, the same wrong interpretations, the same bad practices repeated over and over and over. These aren't people randomly making the same mistakes; they were taught how to make these mistakes. "My professor said..." is almost universally a red flag to me now.
–
John BodeJun 13 '12 at 20:01

There are also a small percentage of people (such as myself) who learned C++ before they
learned C.

I'm sure you know the differences, but if you are a student who has only had a C++
class, and not a C class the parts of C++ that are not C compatible will not
be obvious.

Some of the more obvious differences I've learned (not an exhaustive list)
() struct data types originally could not contain functions,
and can't have private members, meaning it
is very difficult to Enforce the validity rules of an abstract data type in C.
() classes are not supported in C
() passing by reference using the ampersand operator is specific to C++
() C doesn't support streams or templates
(*) malloc and free are intended for use only in C and not in C++

I think this is a key insight... in the old days, you had a C compiler, then along came C++, so you learned the differences. Now you have C/C++ compilers and if you are taught C++ explicitly, it is well neigh impossible to know what is C and what is C++ beyond "the Object Oriented stuff" Also, I'm not sure C/C++ is the most common language to learn in anger(?)
–
Al BiglanJun 12 '12 at 18:56

Well, I don't think that answer is entirely right. The right answer is that C++ has robust support for Object Oriented code. It does not require it. (Which is the source of this confusion in the first place.)
–
Steven BurnapJun 12 '12 at 19:38

Also "you may use Pure C inside a C++ program" could mean something like "C++ is a superset of C, i.e. any C valid program is also a valid C++ program" (wrong). Or it might mean "you can link C++ programs to C libraries" (true, but most languages can link to C libraries some way or another.) You should be much more precise in an actual interview.
–
nikieJun 12 '12 at 21:34

Probably not literally, in that they think C++ and C are one and the same, but in terms of truly understanding and being able to use the different features of C++, yes.

The main cause is the binary nature of listing languages / tools on your resume/CV. Essentially, the standard seems to be that if you got "Hello World" to compile and run in a language, than it is OK to list it on your resume/CV.

As it happens, the C version of "Hello, World!" also compiles and runs in C++. So, absent any other information, all that seeing "C++" on a resume tells me is that this person knows enough C to get "Hello, World!" running, and knows that most C programs will compile in C++.

Given that, I'm going to need to probe that a little bit on the interview. I probably wouldn't do so by asking a "Yes/No" "Do you know the difference?" question, in short because it has an obvious "right" answer. I would probably ask the candidate which language she liked better, why, and if there were any advantages to the one she didn't pick.

As a foreward, note that this answer is not meant to declare that there are no differences or that I profess to know the differences, or even that I know than "Hello World" in either C or C++. It is an answer to the question by framing the terms of reference, pointing out that plenty of people know the elementary differences (e.g. one has some + characters in its name) and very few people will know all or even most of the differences.

It depends what you mean by 'programmer' and what you mean by 'difference'.

I'm a 'programmer' (although I call myself a developer) and I'd struggle to give any real differences between C and C++. If pressed I'd probably say that C++ is a superset of C that has namespaces and inheritence; different ways of dealing with memory. I know enough to patch some bugs or make some changes in your existing program but I can't imagine writing anything more than a simple utility in C or C++. I know enough to get by, but I don't paint myself as "knowing" either of those languages.

I know other 'programmers' (also developers) who wouldn't even tell you the difference between Java and FORTRAN, or Javascript and Pascal. They are good at what they do and they don't do procedural languages.

Then there are millions of mediocre programmers who barely know the single language they work with every day.

The term 'difference' is ambigious. I've pointed out what I see as some differences above, but I know they aren't definitive and complete. Very few people are going to know every difference - a lot more people are going to be able to give some vague answers (as I have) about object orientation.

C and C++ are vastly different languages, coded in vastly different ways. You clearly just don't know them.
–
DeadMGJun 13 '12 at 10:09

@sbi "I don't paint myself as "knowing" either of those languages." I'll let you decide that for yourself.
–
Kirk BroadhurstJun 13 '12 at 22:56

Any feedback on the downvotes? Is it because I don't know the difference between the two? I wouldn't assume that would disqualify me from answering the question.
–
Kirk BroadhurstJun 13 '12 at 23:04

1

@KirkBroadhurst: I think I indicated what part of your answer I disliked enough to downvote, and that comment was upvoted five times as often as you were downvoted after that, so I'm not sure what explanation you're after. However, to elaborate: The term "difference" is sufficient here, since C and C++ share only superficial syntactical similarities, and, other than that, are very different languages. As for qualifications: I don't think there's a qualification needed to answer here, but when an answer is blatantly wrong as this one, it will be downvoted irrelevant of the qualification.
–
sbiJun 14 '12 at 8:53

Is it common for a programmer not to know the difference between C and
C++?

Twenty years ago? Yes.

Today? Not so much.

The reason for this is because the programming landscape has changed in a big way. Many of today's programs are web-based; even programs written for desktops may be written in a higher-level language than C or C++. As such, unless you're a programmer who writes OS code, you may not know much about either of the two languages.

An interviewer may ask this question in an interview to gauge how much you know about programming fundamentals; if you know the difference between C and C++, then you likely know what object-oriented programming is, you probably understand libraries and compilers, you understand memory functions, references, pointers....many things that have influenced the programming languages of today. I don't use C++ much (and I can't really say that I'm an excellent programmer in any language; wisdom will come with time) but I can say that my experience with C++ has definitely made me a better programmer.