GeeksforGeeks

Add Interview/written questions to Interview Corner!!
Register  |  Login

Browsing the topic C/C++ Puzzles

In C and C++, comma (,) can be used in two contexts:

Read More »

Following are the differences between malloc() and new().

Read More »

Consider the below C/C++ program.

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 number is odd. Your are not allowed to use any comparison (==, < , >..etc) or conditional (if, else, switch, ternary operator,..etc) statement.

Read More »

Recursion can be used to do both tasks in one line. Below are one line implementations for stracat() and strcmp().

Read More »

Which of the following two code segments is faster? Assume that compiler makes no optimizations.

Read More »

In C, functions are global by default. The “static” keyword before a function name makes it static. For example, below function fun() is static.

Read More »

Consider the below program.

Read More »

malloc() allocates memory block of given size (in bytes) and returns a pointer to the beginning of the block.

Read More »

Asked by Shobhit
In C, array parameters are treated as pointers. The following two definitions of foo() look different, but to the compiler they mean exactly the same thing.

Read More »

Question: Is there any example for which the following two loops will not work same way?

Read More »

Well, we assume that you know what does it mean by pointer in C. So how do we create a pointer to an integer in C?
Huh..it is pretty simple..

Read More »

Asked by Tanuj
Here is the standard prototype of printf function in C.

Read More »

At the first look, it seems that writing a C macro which prints its argument is child’s play.

Read More »

The Function prototype serves the following purposes -

Read More »

We all know that a function in C can return only one value. So how do we achieve the purpose of returning multiple values.
Well, first take a look at the declaration of a function.

Read More »

First of all, what is function overloading? Function overloading is a feature of a programming language that allows one to have many functions with same name but with different signatures.

Read More »

Write a C program to show memory representation of C variables like int, float, pointer, etc.
Algorithm:
Get the address and size of the variable. Typecast the address to char pointer. Now loop for size of the variable and print the value at the typecasted pointer.

Read More »

Solution: Use sprintf() function.

Read More »

In the below code, change/add only one character and print ‘*’ exactly 20 times.

Read More »