+ 1

C++

Why is c++ better than c language..?

13th Feb 2018, 4:12 PM
ALi TuRii
ALi TuRii - avatar
6 Answers
+ 2
Because it supports object-oriented and generic programming. Edit: That's the main reason, but it also has more cool features, like smart pointers, references, better dynamic memory allocation, a more extensive standard library, an alternative for syntax etc.
13th Feb 2018, 4:16 PM
Vlad Serbu
Vlad Serbu - avatar
+ 2
@Vlad Serbu 1) I agree that STL is great, just saying it’s hard to use. 2) No, Python is infuriatingly overvalued. 3) I recently read an answer on Quora to when you have to use C and not C++, and times like that do exist. If you are working on something that cannot use pointers at all without crashing, C++ is the wrong option because you will be inclined to use the STL, which almost always uses pointers. They had to use C because it was much easier to avoid accidentally using pointers.
16th Feb 2018, 1:47 AM
Jacob Pembleton
Jacob Pembleton - avatar
+ 1
There really is no “this language is better than that language”, besides every language being better than Python, but one advantage it has is the Standard Template Library. This contains all of the features of C++ that are a higher level than C, which includes strings. In C, you have to choose between an array of characters or dealing with pointers. It does this with hardly any speed difference. The problem is that a lot of the STL is very difficult to use and really just adds a new layer of difficulty. You will know what I’m talking about when you someday read the error message, “List iterator non dereferenceable”.
13th Feb 2018, 4:25 PM
Jacob Pembleton
Jacob Pembleton - avatar
+ 1
@Jacob 1) The STL is good, you just have to study it, you can't pick up and use it. 2) Python is cool af. 3) C++ is better than C in the same way that C++11 is better than C++98. C is obsolete.
13th Feb 2018, 4:28 PM
Vlad Serbu
Vlad Serbu - avatar
0
C is also an generic ...
13th Feb 2018, 4:17 PM
ALi TuRii
ALi TuRii - avatar
0
@ALi I mean generic as in class templates, not as in general-purpose
13th Feb 2018, 4:19 PM
Vlad Serbu
Vlad Serbu - avatar