Merge two arrays into one

There are 2 sorted arrays of size m and m+n respectively. First array (of size m) has m elements and Second array (of size m+n) has only n elements (last m positions are blank). So, the total number of elements in both the arrays is m+n (m in first and n in second). Write code […]

Lambda functions and expressions in C++11

In my opinion, the single biggest addition to C++11 is the Lambda function and expressions (for more features in C++ click here…). Look at the case when you are calling std::sort function, you have to specify the comparator function and then pass that function as an argument to std::sort. In such situations, you may want […]

Separate nullptr in C++11

In my earlier articles on C++, I have written about the automatic type detection, uniform initialization list and Range based for loopin C++11. Earlier we used to use the NULL macro which is synonymous to int zero. This came as an inheritance from C language where 0 plays a double role (as an int and as NULL […]

Uniform Initializer lists in C++11

In my previous article about the latest C++11 standard I talked about automatic type detection and keyword decltype Today I will take another major enhancement in C++11 called the Initializer List or Uniform Initialization Syntax. 

C++11 feature – automatic type detection and decltype

C++11 is the latest version of C++ language originally designed by Stroustrup. I read an interview of him where he said that the latest standard (C++11 or C++0x) feels like a new language. I will be publishing the new features added to the core language and to the STL in following articles in next few […]

Permutations of list of elements with repeated values

This question is a variation of a question which I posted earlier “Print Permutations of an Array or String“. The code which I had written there will not work if we have repetitions in the array. Today’s post is to write the code to print all permutations and takes care of the case if there […]

Changing pointer passed to a function as argument

If a function in C/C++ takes a pointer argument and we try to change it (Not the value pointed to by pointer but the pointer itself). It should be done with caution to avoid undesired results …