[algogeeks] Scanf in an infinite loop

2011-09-13 Thread Avinash Dharan
#include stdio.h void main() { while(1) { int opt; scanf(%d,opt); printf(%d\n,opt); } } when i execute this program, if i give a character instead of an integer, it goes into an infinite loop. why is it so? -- You received this message because you are

Re: [algogeeks] Amazon - Interview Qn

2011-08-30 Thread Avinash Dharan
That would work dheerjaj. Only thing is links reassignment should be taken care of. On Wed, Aug 31, 2011 at 10:40 AM, Dheeraj Sharma dheerajsharma1...@gmail.com wrote: remove the 'n' nodes from the beginning..push in the stack..pop them up and insert at the end of linked list..till the stack

Re: [algogeeks] c output doubt

2011-08-12 Thread Avinash Dharan
Pointer incrementation and subtraction are done in terms of memory blocks and not addresses of memory. For example, int *p; p++; The pointer here jumps to the next integer location and not the next address in memory. Similarly,pointer subtraction will give the difference in indexes and not the

Re: [algogeeks] c output doubt

2011-08-12 Thread Avinash Dharan
On Fri, Aug 12, 2011 at 11:55 AM, Avinash Dharan avinashdha...@gmail.comwrote: Pointer incrementation and subtraction are done in terms of memory blocks and not addresses of memory. For example, int *p; p++; The pointer here jumps to the next integer location and not the next address

Re: [algogeeks] what to learn python or perl

2011-03-16 Thread Avinash Dharan
I second them. Python would be my choice. On Wed, Mar 16, 2011 at 10:18 AM, pacific pacific pacific4...@gmail.comwrote: I vote for python. On Wed, Mar 16, 2011 at 10:03 AM, kracekumar ramaraju kracethekingma...@gmail.com wrote: Hello Python vs Perl been battle for more than 20