Given a root of a tree, and an integer k. Print all the nodes which are at k distance from root.
In C printf(), %n is a special format specifier which instead of printing something causes printf() to load the variable pointed by the corresponding argument… Read More »
Method 1 (Using Nested Loops) We can calculate power by using repeated addition.
Ideally delete operator should not be used for this pointer. However, if used, then following points must be considered.
In C++, delete operator should only be used either for the pointers pointing to the memory allocated using new operator or for a NULL pointer,… Read More »
In C and C++, comma (,) can be used in two contexts:
Predict the output of following C programs.
Following are the differences between malloc() and operator new.:
Predict the output of below C++ programs.
In C++, a static member function of a class cannot be virtual. For example, below program gives compilation error.
Consider the below C/C++ program.
Enumeration constants (enum values) are always of type int in C, whereas they are distinct types in C++ and may have size different from that… Read More »
Predict the output of below C programs.
Calling an undeclared function is poor style in C (See this) and illegal in C++. So is passing arguments to a function using a declaration… Read More »
Write a C/C++ program that accepts a number from the user and prints “Even” if the entered number is even and prints “Odd” if the… Read More »