<?xml version="1.0" encoding="UTF-8"?><!-- generator="WordPress/2.9.2" -->
<rss version="0.92">
<channel>
	<title>GeeksforGeeks</title>
	<link>http://geeksforgeeks.org</link>
	<description>Add Interview/written questions to Interview Corner!!</description>
	<lastBuildDate>Wed, 08 Sep 2010 05:40:04 +0000</lastBuildDate>
	<docs>http://backend.userland.com/rss092</docs>
	<language>en</language>
	
	<item>
		<title>G-Fact 30</title>
		<description><![CDATA[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, and free() should only be used either for the pointers pointing to the memory allocated using malloc() or for a NULL pointer. 

#include&#60;stdio.h&#62;
#include&#60;stdlib.h&#62;
int main()
{
    int x;
  [...]]]></description>
		<link>http://geeksforgeeks.org/?p=8539</link>
			</item>
	<item>
		<title>Comma in C and C++</title>
		<description><![CDATA[In C and C++, comma (,) can be used in two contexts: 
1) Comma as an operator:
The comma operator (represented by the token ,) is a binary operator that evaluates its first operand and discards the result, it then evaluates the second operand and returns this value (and type). The comma operator has the lowest [...]]]></description>
		<link>http://geeksforgeeks.org/?p=8482</link>
			</item>
	<item>
		<title>Output of C Program &#124; Set 17</title>
		<description><![CDATA[Predict the output of following C programs.
Question 1

#include&#60;stdio.h&#62;

#define R 10
#define C 20

int main()
{
   int (*p)[R][C];
   printf(&#34;%d&#34;,  sizeof(*p));
   getchar();
   return 0;
}

Output: 10*20*sizeof(int) which is &#8220;800&#8243; for compilers with integer size as 4 bytes.
The pointer p is de-referenced, hence it yields type of the object. In the present [...]]]></description>
		<link>http://geeksforgeeks.org/?p=8453</link>
			</item>
	<item>
		<title>malloc() vs new()</title>
		<description><![CDATA[Following are the differences between malloc() and new(). 
1) new() calls constructors, while malloc() does not.  In fact primitive data types (char, int, float.. etc) can also be initialized with new().  For example, below program prints 10.

#include&#60;iostream&#62;

using namespace std;

int main()
{
   int *n = new int(10); // initialization with new()
   [...]]]></description>
		<link>http://geeksforgeeks.org/?p=8378</link>
			</item>
	<item>
		<title>Output of C++ Program &#124; Set 1</title>
		<description><![CDATA[Predict the output of below C++ programs. 
Question 1

// Assume that integers take 4 bytes.
#include&#60;iostream&#62;

using namespace std;   

class Test
{
  static int i;
  int j;
};

int Test::i;

int main()
{
    cout &#60;&#60; sizeof(Test);
    getchar();
    return 0;
}

Output: 4 (size of integer)
static data members do not contribute in [...]]]></description>
		<link>http://geeksforgeeks.org/?p=8418</link>
			</item>
	<item>
		<title>G-Fact 29</title>
		<description><![CDATA[In C++, a static member function of a class cannot be virtual.  For example, below program gives compilation error.

#include&#60;iostream&#62;

using namespace std;    

class Test
{
   public:
      // Error: Virtual member functions cannot be static
      virtual static void fun()  { }
};

Also, [...]]]></description>
		<link>http://geeksforgeeks.org/?p=8413</link>
			</item>
	<item>
		<title>Evaluation order of operands</title>
		<description><![CDATA[Consider the below C/C++ program. 

#include&#60;stdio.h&#62;
int x = 0;

int f1()
{
  x = 5;
  return x;
}

int f2()
{
  x = 10;
  return x;
}

int main()
{
  int p = f1() + f2();
  printf(&#34;%d &#34;, x);
  getchar();
  return 0;
}

What would the output of the above program &#8211; &#8216;5&#8242; or &#8216;10&#8242;?
The output is [...]]]></description>
		<link>http://geeksforgeeks.org/?p=8389</link>
			</item>
	<item>
		<title>G-Fact 28</title>
		<description><![CDATA[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 of int.
Source:
http://en.wikipedia.org/wiki/Compatibility_of_C_and_C%2B%2B
]]></description>
		<link>http://geeksforgeeks.org/?p=8383</link>
			</item>
	<item>
		<title>Output of C Programs &#124; Set 16</title>
		<description><![CDATA[Predict the output of below C programs.
Question 1

#include &#60;stdio.h&#62;

char* fun()
{
  return &#34;awake&#34;;
}
int main()
{
  printf(&#34;%s&#34;,fun()+ printf(&#34;I see you&#34;));
  getchar();
  return 0;
}

Output: Some string starting with &#8220;I see you&#8221;
Explanation: (Thanks to Venki for suggesting this solution)
The function fun() returns pointer to char. Apart from printing string &#8220;I see you&#8221;, printf() function returns number [...]]]></description>
		<link>http://geeksforgeeks.org/?p=8355</link>
			</item>
	<item>
		<title>G-Fact 27</title>
		<description><![CDATA[Calling an undeclared function is poor style in C and illegal in C++. So is passing arguments to a function using a declaration that doesn&#8217;t list argument types: 
If we save the below program in a .c file and compile it, it works without any error. But, if we save the same in a .cpp [...]]]></description>
		<link>http://geeksforgeeks.org/?p=7917</link>
			</item>
	<item>
		<title>Print &#8220;Even&#8221; or &#8220;Odd&#8221; without using Condtional statement</title>
		<description><![CDATA[Write a C/C++ program that accepts a number from the user and prints &#8220;Even&#8221; if the entered number is even and prints &#8220;Odd&#8221; if the number is odd.  Your are not allowed to use any comparison (==, ..etc) or conditional (if, else, switch, ternary operator,..etc) statement.
Solution:
Below tricky code can be used to print &#8220;Even&#8221; [...]]]></description>
		<link>http://geeksforgeeks.org/?p=8337</link>
			</item>
	<item>
		<title>G-Fact 26</title>
		<description><![CDATA[In C++, compiler by default creates default constructor for every class.  But, if we define our own parametrized constructor, then compiler doesn&#8217;t create the default constructor and default constructor may not exist in the class.
For example, program 1 compiles without any error, but compilation of program 2 fails with error &#8220;no matching function for [...]]]></description>
		<link>http://geeksforgeeks.org/?p=8316</link>
			</item>
	<item>
		<title>Output of C Programs &#124; Set 15</title>
		<description><![CDATA[Predict the output of below C programs. 
Question 1

#include&#60;stdio.h&#62;
int main(void)
{
  int a = 1;
  int b = 0;
  b = ++a + ++a;
  printf(&#34;%d %d&#34;,a,b);
  getchar();
  return 0;
}

Output: Undefined Behavior
See http://en.wikipedia.org/wiki/C_syntax#Undefined_behavior )

Question 2

#include&#60;stdio.h&#62;

int main()
{
  int a[] = {1, 2, 3, 4, 5, 6};
  int *ptr = (int*)(&#38;a+1);
 [...]]]></description>
		<link>http://geeksforgeeks.org/?p=8113</link>
			</item>
</channel>
</rss>
