Re: [algogeeks] c question what is output?

2011-08-21 Thread sagar pareek
FUNC2(i) = i==0?i*(i-1*(i-1-1)) 8==0?1:8*(8-1*(8-1-1)) 8==0?1:8*(8-6) 8==0?1:8*2 8==0?1:16 hence it will return 16 On Sun, Aug 21, 2011 at 11:40 AM, SuDhir mIsHra sudhir08.mis...@gmail.comwrote: #includestdio.h #define FUNC1(i) (i*(i-1)) #define FUNC2(i) (i==0?1:i*FUNC1(i-1)) main() {

Re: [algogeeks] c question what is output?

2011-08-21 Thread Sanjay Rajpal
+1 to sagar Sanju :) On Sun, Aug 21, 2011 at 3:26 AM, sagar pareek sagarpar...@gmail.com wrote: FUNC2(i) = i==0?i*(i-1*(i-1-1)) 8==0?1:8*(8-1*(8-1-1)) 8==0?1:8*(8-6) 8==0?1:8*2 8==0?1:16 hence it will return 16 On Sun, Aug 21, 2011 at 11:40 AM, SuDhir mIsHra

Re: [algogeeks] c question what is output?

2011-08-21 Thread Ayswarya Srinivasan
doesn it work like below ? func2(8)= 8 * func1(7) func1(7)= 7*6 so i=8*7*6??? On Sun, Aug 21, 2011 at 3:58 PM, Sanjay Rajpal srn...@gmail.com wrote: +1 to sagar Sanju :) On Sun, Aug 21, 2011 at 3:26 AM, sagar pareek sagarpar...@gmail.comwrote: FUNC2(i) = i==0?i*(i-1*(i-1-1))

Re: [algogeeks] c question what is output?

2011-08-21 Thread Sanjay Rajpal
Nopes, its a funda of PRE-PROCESSOR directives. Look before the object code is generated for the program, all the occurences of the MACROs are replaced with their expansions as such as in the definition. So what u r doing is completely wrong. For more info on MACROs, refer any text book of C.