Category Archives: C/C++

typedef versus #define in C

typedef : typedef is used to give data type a new name, for example Output : c #define : is a C directive which is used to #define alias. Output : Hyderabad typedef is different from #define among the following aspects typedef is limited to giving symbolic names to types only, where as #define can… Read More »

Command Injection Vulnerability and Mitigation

Command injection is basically injection of operating system commands to be executed through a web-app. The purpose of the command injection attack is to inject and execute commands specified by the attacker in the vulnerable application. In situation like this, the application, which executes unwanted system commands, is like a pseudo system shell, and the… Read More »

Descending order in Map and Multimap of C++ STL

We have discussed map in C++ STL and multimap in C++ STL. The default behavior of these data structures is to store elements in ascending order. How to ensure reverse order or descending order when inserting elements in map and multimap. The idea is to greater function when an instance of map/multimap. Descending order in… Read More »

Binary Search functions in C++ STL (binary_search, lower_bound and upper_bound)

Binary search is an important component in competitive programming or any algorithmic competition, having knowledge of shorthand functions reduces the time to code them. This searching only works when container is sorted. Related functions are discussed below. 1.binary_search(start_ptr, end_ptr, num) : This function returns boolean true if the element is present in the container, else… Read More »

Output of C Program | Set 29

Question 1 How many times main() will get called? Answer : Infinite loop Description : There is no condition in the main() to stop the recursive calling of the main() hence it will be called infinite no of times. Question 2 Guess the output of the following program : Answer : x and y are… Read More »