Category Archives: C

Print colored message with different fonts and sizes in C

In C/C++ we can use graphics.h header file for creation of programs which uses graphical functions like creating different objects, setting the color of text, printing messages in different fonts and size, changing the background of our output console and much more. Here we will create a program which will print message (“geeks”) in colored… Read More »

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 »

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 »

How does Duff’s Device work?

Duff’s device is a trick to express loop unrolling directly in C or C++ without extra code to treat the leftover partial loop.The trick is to use a switch statement where all but one of the cases labels are in the middle of a while loop. Further, all cases fall through to the end of… Read More »