Close

Type casting in C++ – Part 1

Type casting frequently arises in real life programming. This post concentrates on type conversion of fundamental data types. Type casting is the process of converting from one data type to another. In C++, type casting is automatic in some situations. These are called implicit conversions. For example char c = ‘A’; int ch_code = c;…

C++ STL Algorithms – Sort- Part-1

Sorting is one of the most widely used algorithmic primitive in programming.  C++ Standard Template Library (STL) provides an efficient implementation of the sort algorithm. It is always better to use this algorithm instead of writing our own implementation because of the following benefits. It’s performance would surely be better than your own implementation. It’s…

Size of an empty object in C++

What is the size of an empty object in C++? This is one of the most frequently asked questions on forums. For example consider the following code snippet. class A { }; A aOb; cout << sizeof(aOb); The size of an empty object is not zero to ensure that the addresses of two different objects…