Moving from C to C++

Sai Ankit
3 min readAug 3, 2021

--

Learning C++ from scratch is a futile exercise when you can shift from C to C++ in an ingenious way.

Most of the students in India are taught C as their first programming language in colleges. However, shifting to C++ is a necessity in the current era. Competitive Programming, afield which is very popular in the current scenario and which is full of C++ and Java programmers ( maximum percentage ). Obviously, the available resources on the internet pertaining to this field would be mainly in C++ / Java. C++ has STL, which dominates C in terms of productivity during CC Competitions.

What to do?

Syntax of basic programming paradigms such as conditionals, loops do not change in C and C++. There are some vital fundamental differences that I will list out, and you can quickly learn them and imbibe within 5 min.

Preprocessor Directives
You can see in the below picture difference between the preprocessor directives in C ( left ) and C++ ( right )

C(left) || C++(right)

Standard Input
Taking in C input is cumbersome because you have to strictly case the stuff inside the bracket based on the data type of the input variable. But in C++ is so damn simple. Any data type you declare can be easily cinned.

C(left) || C++(right)

Standard Output
Printing output in C is also boring because you have to strictly case the stuff inside the bracket based on the variable’s data type. But in C++ is simple. Any data type you declare can be easily coutted.

These 3 are the main key differences between C and C++. Transitioning from C to C++ does not only involve moving from printf to cout. There is much more, but the basic stuff is done, and you are good to go with some fundamental problems in C++ to make sure you are good with the requisite differences between C and C++.

Some Practice Problems to test your transition skills
1. Watermelon
2. Team

Now that you have understood the basic differences, it’s time to jump deep into more notable features of C++ 🤑

  1. STL Best Playlist

Once you have understood these, you are good to go with many of the basic questions with C++

But some understanding of Object Oriented stuff in C++ would be helpful ( coz C++ is an object oriented language unlike C )

Object Oriented Programming (OOP) in C++ Course

Clap the post if you did feel helpful.
Please do have a look into my YouTube channel: Code Studio Sai Ankit that discusses everything related to coding from Computer Science Concepts, Competitive Coding tutorials, Codeforces Editorials, Development Projects.
Please also do leave a like and Subscribe on the content you like 👍.

--

--