[algogeeks] Re: Print 1 to n one per each line on the standard output

2010-09-23 Thread Greed
You can use setjmp ,longjmp or goto to get desired result. #includestdio.h #includesetjmp.h void print(int v) { int i=0; jmp_buf env; setjmp(env); if(i=v) { printf(%d\n,i); ++i; longjmp(env,1); } }

Re: [algogeeks] Re: Print 1 to n one per each line on the standard output

2010-09-23 Thread coolfrog$
@Greed in windows.. output is infinite loop and printing... 0 0 0 0 0 ... infinite loop.. On Thu, Sep 23, 2010 at 9:57 AM, Greed shrishkr...@gmail.com wrote: You can use setjmp ,longjmp or goto to get desired result. #includestdio.h #includesetjmp.h void print(int v) {

Re: [algogeeks] Re: Print 1 to n one per each line on the standard output

2010-09-23 Thread Nishant Agarwal
try in linux.it is working fine On Thu, Sep 23, 2010 at 8:58 PM, coolfrog$ dixit.coolfrog.div...@gmail.comwrote: @Greed in windows.. output is infinite loop and printing... 0 0 0 0 0 ... infinite loop.. On Thu, Sep 23, 2010 at 9:57 AM, Greed shrishkr...@gmail.com wrote:

[algogeeks] Re: Print 1 to n one per each line on the standard output

2010-09-22 Thread Yellow Sapphire
The question is to get an algorithm or a program. If it's a program then using execl() or fork() system call you can code this. The code will not be a recursion in a sense that we will not call functions recursively but will call the programs (executable code) recursively. On Sep 22, 8:49 pm,