C or C++ ?

I have come across many times that many good coders use C instead of C++. Why is so? I myself find C++ better for coding. Should I start coding in C?

Code in the language you are most comfortable with. C++ is an excellent choice due to its ready implementation of useful libraries, data structures and ready-to-use methods which you will have to write from scratch in C.

Well , one of the reasons for using C over C++ in competitive programming is because of the speed of scanf() over cin. scanf() takes less execution time than cin, and most new users who find out about this advantage use them, and hence, their code’s might seem to be more like C , when they are actually C++ programmers ( the advantage of many C functions working on C++ is also to be noted ).

Please note that the more established users would use getchar_unlocked() over scanf(). This is one of the main reason for it. I’m saying this because that’s what I used to do ( I’m sorry for bringing up my personal experience, but it is one of the main reasons ) . I was originally a C++ programmer, and I programmed in C++. But when I found about the speed advantage of using some C functions over C++, I started using them, and soon, the code would look entirely C.

So, since most part of C can be used on C++, it won’t harm to learn C as well. But, it’s better to have C++ as your main language and use C for certain parts ( like to improve speed, etc ). It’s also good to learn C++ because of the large amount of Libraries available in C++.

But, the most important thing is to practice. With lots of practice, you can get better in any language ( but remember that no one is perfect and we all make mistakes , so it’s nothing to be ashamed of to ask for help ) . So, when you choose to learn a language, make sure to work hard and always try to learn new things. In the world of programming, experience is what will help you get better, and there is no other shortcut than practice.

Happy Coding…

1 Like

As far as contests, use the latest version of C++ (currently C++14). As the above answer notes there are I/O performance issues to be aware of.

Outside of contests, there are many (often low-level) projects in C.

C++ provides you stl and object oriented programming. Just see the below link i hope you would continue with c++ only.

link - http://tech.co/heres-a-ranking-of-the-highest-paying-programming-languages-2014-11

By the way i have seen many good coders in c++ also!!!

As per to your tags see – http://stackoverflow.com/questions/497786/why-would-anybody-use-c-over-c