[algogeeks] Re: output plzz

2011-06-25 Thread RITESH SRIVASTAV
sizeof returns size_t values and size_t is typedef unsigned int size_t; but when you compare it with -1(int) ,d=-1 is converted to unsigned int which becomes very large (INT_MAX) and d (INT_MAX) 7 so the loop is never executed. On Jun 25, 3:23 pm, harshit pahuja hpahuja.mn...@gmail.com wrote:

[algogeeks] Re: can void pointer be incremented

2011-06-24 Thread RITESH SRIVASTAV
C standard doesn't say anything about void pointer increment. If you will do sizeof(void) ,I guess your gcc compiler will give you 1 as output. In C, for compatibility with the old implementation (where void * were used in place of char * and vice-versa) doing this will not result in error on some

[algogeeks] Re: Explain this.....

2011-06-22 Thread RITESH SRIVASTAV
In any function call , the comma operator used is not a sequence point so the order of evaluation of the arguments sent to the function is not defined .That is why it is giving different output on different compilers. On Jun 22, 7:29 pm, Piyush Sinha ecstasy.piy...@gmail.com wrote: I am using

[algogeeks] Re: preincrement and post increment

2011-06-20 Thread RITESH SRIVASTAV
It relates to the concept of lvalue and rvalue. In C++, pre-increment produces lvalue which can be modified . ( but because of absence of sequence point in the twice modification of variable val, the result is undefined.) In C , pre-increment does not produce lvalue so it can't be modified ,hence

[algogeeks] Re: spoj problem chairs

2011-06-20 Thread RITESH SRIVASTAV
@Saurabh Your formula is incorrect. for input : 5 2 the answer should be 5 but your program gives 12 as output. On Jun 19, 11:35 pm, abc abc may.i.answ...@gmail.com wrote: @above   Better you ask it on spoj forum On Sun, Jun 19, 2011 at 7:27 PM, saurabh singh saurab...@gmail.com wrote: I am

[algogeeks] Re: preincrement and post increment

2011-06-20 Thread RITESH SRIVASTAV
bt preincrement produces rvalue in c nd lvalue in c++. On Mon, Jun 20, 2011 at 5:03 PM, RITESH SRIVASTAV riteshkumar...@gmail.comwrote: It relates to the concept of lvalue and rvalue. In C++, pre-increment produces lvalue which can be modified . ( but because of absence

[algogeeks] Re: interesting c++ questions

2010-08-04 Thread RITESH SRIVASTAV
1) A constructor can call another constructor but not for the same object if we are talking just the precise meaning of object and not considering the raw storage as Objects. 4) Destructor can be called explicitly .This is generally used when u have used your own new operator so that

[algogeeks] Re: interview-question

2010-08-03 Thread RITESH SRIVASTAV
level of the tree is given or not ? and where do we have to output V , just at the node we get it or at the root ? On Aug 3, 1:56 pm, jalaj jaiswal jalaj.jaiswa...@gmail.com wrote: given a complete binary tree (either a node is a leaf node or has two children) every leaf node has value 0 or