Re: [algogeeks] O/P

2011-08-12 Thread Amol Sharma
@dipankar +1
--


Amol Sharma
Third Year Student
Computer Science and Engineering
MNNIT Allahabad




On Fri, Aug 12, 2011 at 9:31 AM, Dipankar Patro  wrote:

> The question is full of errors.
> Provide the link, if you have copied it from somewhere.
>
>
> On 11 August 2011 23:53, Mani Bharathi  wrote:
>
>> What will be the output of the following program
>> #include
>> int main()
>> {
>> int m=10,p;
>> p=incre(incre (incre (++) incre) incre)
>> Printf("%d", *&P);
>> return 0;
>> }
>> incre (int m)
>> {
>> m+=2;
>> return(m-2);
>> }
>>
>> how?
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msg/algogeeks/-/58_0-nbLUacJ.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>
>
> --
>
> ___
>
> Please do not print this e-mail until urgent requirement. Go Green!!
> Save Papers <=> Save Trees
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] O/P

2011-08-11 Thread Dipankar Patro
The question is full of errors.
Provide the link, if you have copied it from somewhere.

On 11 August 2011 23:53, Mani Bharathi  wrote:

> What will be the output of the following program
> #include
> int main()
> {
> int m=10,p;
> p=incre(incre (incre (++) incre) incre)
> Printf("%d", *&P);
> return 0;
> }
> incre (int m)
> {
> m+=2;
> return(m-2);
> }
>
> how?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/algogeeks/-/58_0-nbLUacJ.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
___

Please do not print this e-mail until urgent requirement. Go Green!!
Save Papers <=> Save Trees

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] O/P

2011-08-11 Thread Mani Bharathi
What will be the output of the following program
#include
int main()
{
int m=10,p;
p=incre(incre (incre (++) incre) incre)
Printf("%d", *&P);
return 0;
}
incre (int m)
{
m+=2;
return(m-2);
}

how?

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/algogeeks/-/58_0-nbLUacJ.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] o/p

2011-08-09 Thread Prakash D
@rajkumar: thanks

#include 

#define max(a,b) ((a>b)?a:b)
int main()
{
 int m,n;
 m=3+max(2,3);
 n=2*max(3,2);
 printf("%d,%d",m,n);

getchar();
return 0;
}

this gives the correct output as 6,6



On Mon, Aug 8, 2011 at 7:12 PM, Dipankar Patro  wrote:

> relational operators give 0/1 output;
> (a>b) - will be either 0 or 1.
> similarly (a==b) will either be 0 or 1
>
>
> On 8 August 2011 18:39, Anil Arya  wrote:
>
>> in expression (a>b)?a:b--->(a>b) returns 1 if true  and  0 if
>> (false) .
>>
>>
>>
>> On Mon, Aug 8, 2011 at 6:08 PM, dilip makwana wrote:
>>
>>> Since test condition will always evaluate to non-zero value (which is
>>> considered true in c/c++) hence always first option get selected 
>>>
>>>
>>> On 8 August 2011 17:44, Shachindra A C  wrote:
>>>
 oops...I'm sorry.. the statement would evaluate to 3 + *0* ? 2 : 3 ==>
 *3* ? 2 : 3 ==> m = 2.


 On Mon, Aug 8, 2011 at 5:43 PM, Shachindra A C 
 wrote:

> @raj,
>  the preprocessed file would contain m=3+(2>3)?2:3 AFAIK.
>
>  So, the statement would evaluate to 3 + 1 ? 2 : 3 ==> 4 ? 2 :
> 3 ==> m = 2.
>
>  Likewise for n.
>
>
>  On Mon, Aug 8, 2011 at 5:21 PM, raj kumar wrote:
>
>> 3+2>3?2:3
>> so 5>3 hence 2 is returned bcoz of higher precedence of + over ?
>> Thanks
>>
>>  --
>> You received this message because you are subscribed to the Google
>> Groups "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>
>
> --
> Regards,
> Shachindra A C
>
>


 --
 Regards,
 Shachindra A C

  --
 You received this message because you are subscribed to the Google
 Groups "Algorithm Geeks" group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.

>>>
>>>
>>>
>>> --
>>> *Dilip Makwana*
>>> VJTI
>>> BTech Computers Engineering
>>> 2009-2013
>>>
>>>  --
>>> You received this message because you are subscribed to the Google Groups
>>> "Algorithm Geeks" group.
>>> To post to this group, send email to algogeeks@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> algogeeks+unsubscr...@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>
>>
>>
>> --
>> Anil Kumar Arya
>> B.Tech  III year
>> computer science & engineering
>> M.N.N.I.T Allahabad.
>>
>>
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>
>
> --
>
> ___
>
> Please do not print this e-mail until urgent requirement. Go Green!!
> Save Papers <=> Save Trees
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] o/p

2011-08-08 Thread Dipankar Patro
relational operators give 0/1 output;
(a>b) - will be either 0 or 1.
similarly (a==b) will either be 0 or 1

On 8 August 2011 18:39, Anil Arya  wrote:

> in expression (a>b)?a:b--->(a>b) returns 1 if true  and  0 if
> (false) .
>
>
>
> On Mon, Aug 8, 2011 at 6:08 PM, dilip makwana wrote:
>
>> Since test condition will always evaluate to non-zero value (which is
>> considered true in c/c++) hence always first option get selected 
>>
>>
>> On 8 August 2011 17:44, Shachindra A C  wrote:
>>
>>> oops...I'm sorry.. the statement would evaluate to 3 + *0* ? 2 : 3 ==> *
>>> 3* ? 2 : 3 ==> m = 2.
>>>
>>>
>>> On Mon, Aug 8, 2011 at 5:43 PM, Shachindra A C wrote:
>>>
 @raj,
  the preprocessed file would contain m=3+(2>3)?2:3 AFAIK.

  So, the statement would evaluate to 3 + 1 ? 2 : 3 ==> 4 ? 2 : 3
 ==> m = 2.

  Likewise for n.


  On Mon, Aug 8, 2011 at 5:21 PM, raj kumar wrote:

> 3+2>3?2:3
> so 5>3 hence 2 is returned bcoz of higher precedence of + over ?
> Thanks
>
>  --
> You received this message because you are subscribed to the Google
> Groups "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



 --
 Regards,
 Shachindra A C


>>>
>>>
>>> --
>>> Regards,
>>> Shachindra A C
>>>
>>>  --
>>> You received this message because you are subscribed to the Google Groups
>>> "Algorithm Geeks" group.
>>> To post to this group, send email to algogeeks@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> algogeeks+unsubscr...@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>
>>
>>
>> --
>> *Dilip Makwana*
>> VJTI
>> BTech Computers Engineering
>> 2009-2013
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>
>
> --
> Anil Kumar Arya
> B.Tech  III year
> computer science & engineering
> M.N.N.I.T Allahabad.
>
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
___

Please do not print this e-mail until urgent requirement. Go Green!!
Save Papers <=> Save Trees

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] o/p

2011-08-08 Thread Anil Arya
in expression (a>b)?a:b--->(a>b) returns 1 if true  and  0 if
(false) .


On Mon, Aug 8, 2011 at 6:08 PM, dilip makwana wrote:

> Since test condition will always evaluate to non-zero value (which is
> considered true in c/c++) hence always first option get selected 
>
>
> On 8 August 2011 17:44, Shachindra A C  wrote:
>
>> oops...I'm sorry.. the statement would evaluate to 3 + *0* ? 2 : 3 ==> *3
>> * ? 2 : 3 ==> m = 2.
>>
>>
>> On Mon, Aug 8, 2011 at 5:43 PM, Shachindra A C wrote:
>>
>>> @raj,
>>>  the preprocessed file would contain m=3+(2>3)?2:3 AFAIK.
>>>
>>>  So, the statement would evaluate to 3 + 1 ? 2 : 3 ==> 4 ? 2 : 3
>>> ==> m = 2.
>>>
>>>  Likewise for n.
>>>
>>>
>>>  On Mon, Aug 8, 2011 at 5:21 PM, raj kumar wrote:
>>>
 3+2>3?2:3
 so 5>3 hence 2 is returned bcoz of higher precedence of + over ?
 Thanks

  --
 You received this message because you are subscribed to the Google
 Groups "Algorithm Geeks" group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.

>>>
>>>
>>>
>>> --
>>> Regards,
>>> Shachindra A C
>>>
>>>
>>
>>
>> --
>> Regards,
>> Shachindra A C
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>
>
> --
> *Dilip Makwana*
> VJTI
> BTech Computers Engineering
> 2009-2013
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
Anil Kumar Arya
B.Tech  III year
computer science & engineering
M.N.N.I.T Allahabad.

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] o/p

2011-08-08 Thread dilip makwana
Since test condition will always evaluate to non-zero value (which is
considered true in c/c++) hence always first option get selected 

On 8 August 2011 17:44, Shachindra A C  wrote:

> oops...I'm sorry.. the statement would evaluate to 3 + *0* ? 2 : 3 ==> *3*? 2 
> : 3 ==> m = 2.
>
>
> On Mon, Aug 8, 2011 at 5:43 PM, Shachindra A C wrote:
>
>> @raj,
>>  the preprocessed file would contain m=3+(2>3)?2:3 AFAIK.
>>
>>  So, the statement would evaluate to 3 + 1 ? 2 : 3 ==> 4 ? 2 : 3
>> ==> m = 2.
>>
>>  Likewise for n.
>>
>>
>>  On Mon, Aug 8, 2011 at 5:21 PM, raj kumar wrote:
>>
>>> 3+2>3?2:3
>>> so 5>3 hence 2 is returned bcoz of higher precedence of + over ?
>>> Thanks
>>>
>>>  --
>>> You received this message because you are subscribed to the Google Groups
>>> "Algorithm Geeks" group.
>>> To post to this group, send email to algogeeks@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> algogeeks+unsubscr...@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>
>>
>>
>> --
>> Regards,
>> Shachindra A C
>>
>>
>
>
> --
> Regards,
> Shachindra A C
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
*Dilip Makwana*
VJTI
BTech Computers Engineering
2009-2013

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] o/p

2011-08-08 Thread Shachindra A C
oops...I'm sorry.. the statement would evaluate to 3 + *0* ? 2 : 3 ==> *3* ?
2 : 3 ==> m = 2.

On Mon, Aug 8, 2011 at 5:43 PM, Shachindra A C wrote:

> @raj,
>  the preprocessed file would contain m=3+(2>3)?2:3 AFAIK.
>
>  So, the statement would evaluate to 3 + 1 ? 2 : 3 ==> 4 ? 2 : 3
> ==> m = 2.
>
>  Likewise for n.
>
>
>  On Mon, Aug 8, 2011 at 5:21 PM, raj kumar wrote:
>
>> 3+2>3?2:3
>> so 5>3 hence 2 is returned bcoz of higher precedence of + over ?
>> Thanks
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>
>
> --
> Regards,
> Shachindra A C
>
>


-- 
Regards,
Shachindra A C

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] o/p

2011-08-08 Thread Shachindra A C
@raj,
 the preprocessed file would contain m=3+(2>3)?2:3 AFAIK.

 So, the statement would evaluate to 3 + 1 ? 2 : 3 ==> 4 ? 2 : 3 ==>
m = 2.

 Likewise for n.


 On Mon, Aug 8, 2011 at 5:21 PM, raj kumar  wrote:

> 3+2>3?2:3
> so 5>3 hence 2 is returned bcoz of higher precedence of + over ?
> Thanks
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
Regards,
Shachindra A C

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] o/p

2011-08-08 Thread raj kumar
3+2>3?2:3
so 5>3 hence 2 is returned bcoz of higher precedence of + over ?
Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] o/p

2011-08-08 Thread Prakash D
how 2,3 any idea??

On Mon, Aug 8, 2011 at 5:09 PM, raj kumar  wrote:

> I think you forgot to give a space between macro and it's expansion that's
> why
> max(a,b)(a>b)?a:b
> is getting expanded to null
> and the above result
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] o/p

2011-08-08 Thread raj kumar
Sorry that's not the reason i running  that code on my machine  i understood
the reason is something else

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] o/p

2011-08-08 Thread raj kumar
I think you forgot to give a space between macro and it's expansion that's
why
max(a,b)(a>b)?a:b
is getting expanded to null
and the above result

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] o/p

2011-08-08 Thread Shachindra A C
the statement will be transformed to :
 m=3+(2>3)?2:3;
 n=2*(3>2)?3:2;

which will become

m = 3 + 0 ? 2 : 3;
n =  2 * 1 ? 3 : 2;



On Mon, Aug 8, 2011 at 3:46 PM, Kamakshii Aggarwal wrote:

> thanks..got it...
>
>
> On Mon, Aug 8, 2011 at 3:45 PM, jagrati verma  > wrote:
>
>>  #define max(a,b)((a>b)?a:b)
>>
>> use parenthese thn it will giv the correct o/p
>>
>> On Mon, Aug 8, 2011 at 3:27 PM, Kamakshii Aggarwal
>>  wrote:
>> > #include 
>> >
>> > #define max(a,b)(a>b)?a:b
>> > int main()
>> > {
>> >  int m,n;
>> >  m=3+max(2,3);
>> >  n=2*max(3,2);
>> >  printf("%d,%d",m,n);
>> > getchar();
>> > return 0;
>> > }
>> > y the o/p is 2,3,,please explain
>> > --
>> > Regards,
>> > Kamakshi
>> > kamakshi...@gmail.com
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> Groups
>> > "Algorithm Geeks" group.
>> > To post to this group, send email to algogeeks@googlegroups.com.
>> > To unsubscribe from this group, send email to
>> > algogeeks+unsubscr...@googlegroups.com.
>> > For more options, visit this group at
>> > http://groups.google.com/group/algogeeks?hl=en.
>> >
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>>
>
>
> --
> Regards,
> Kamakshi
> kamakshi...@gmail.com
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
Regards,
Shachindra A C

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] o/p

2011-08-08 Thread Kamakshii Aggarwal
thanks..got it...

On Mon, Aug 8, 2011 at 3:45 PM, jagrati verma
wrote:

>  #define max(a,b)((a>b)?a:b)
>
> use parenthese thn it will giv the correct o/p
>
> On Mon, Aug 8, 2011 at 3:27 PM, Kamakshii Aggarwal
>  wrote:
> > #include 
> >
> > #define max(a,b)(a>b)?a:b
> > int main()
> > {
> >  int m,n;
> >  m=3+max(2,3);
> >  n=2*max(3,2);
> >  printf("%d,%d",m,n);
> > getchar();
> > return 0;
> > }
> > y the o/p is 2,3,,please explain
> > --
> > Regards,
> > Kamakshi
> > kamakshi...@gmail.com
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Algorithm Geeks" group.
> > To post to this group, send email to algogeeks@googlegroups.com.
> > To unsubscribe from this group, send email to
> > algogeeks+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> > http://groups.google.com/group/algogeeks?hl=en.
> >
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>


-- 
Regards,
Kamakshi
kamakshi...@gmail.com

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] o/p

2011-08-08 Thread jagrati verma
 #define max(a,b)((a>b)?a:b)

use parenthese thn it will giv the correct o/p

On Mon, Aug 8, 2011 at 3:27 PM, Kamakshii Aggarwal
 wrote:
> #include 
>
> #define max(a,b)(a>b)?a:b
> int main()
> {
>  int m,n;
>  m=3+max(2,3);
>  n=2*max(3,2);
>  printf("%d,%d",m,n);
>     getchar();
>     return 0;
> }
> y the o/p is 2,3,,please explain
> --
> Regards,
> Kamakshi
> kamakshi...@gmail.com
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] o/p

2011-08-08 Thread Neeraj Gupta
Precedence of + is higher than ?

On Mon, Aug 8, 2011 at 3:27 PM, Kamakshii Aggarwal wrote:

> #include 
>
> #define max(a,b)(a>b)?a:b
> int main()
> {
>  int m,n;
>  m=3+max(2,3);
>  n=2*max(3,2);
>  printf("%d,%d",m,n);
>
> getchar();
> return 0;
> }
>
> y the o/p is 2,3,,please explain
>
> --
> Regards,
> Kamakshi
> kamakshi...@gmail.com
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] o/p

2011-08-08 Thread Kamakshii Aggarwal
#include 

#define max(a,b)(a>b)?a:b
int main()
{
 int m,n;
 m=3+max(2,3);
 n=2*max(3,2);
 printf("%d,%d",m,n);

getchar();
return 0;
}

y the o/p is 2,3,,please explain

-- 
Regards,
Kamakshi
kamakshi...@gmail.com

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] o/p

2011-08-07 Thread Kamakshii Aggarwal
what is the problem with the following code

void fun(int **p)
{
  static int q = 10;

  *p = &q;
}

int main()
{
  int r = 20;
  int *p = &r;
  fun(*p);

  printf("%d", *p);
  getchar();
  return 0;
}


-- 
Regards,
Kamakshi
kamakshi...@gmail.com

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] o/p

2011-02-06 Thread aditya pratap
thanks jalaj :)

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] o/p

2011-02-06 Thread jalaj jaiswal
the logic is :-
int is stored in 32 bits in our systems

300 is   0001 00101100
as ptr is character pointer, it points to lower 8 bits
and when *++ptr=2 gets executed then 0001 changes to 0010(equal to
2)

so i becomes   0010 00101100 which is 556 :D

On Sun, Feb 6, 2011 at 10:26 PM, aditya pratap
wrote:

> @jalaj : gcc compiler.
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
With Regards,
*Jalaj Jaiswal* (+919019947895)
Final Year Undergraduate,
IIIT ALLAHABAD

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] o/p

2011-02-06 Thread aditya pratap
@jalaj : gcc compiler.

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] o/p

2011-02-06 Thread jalaj jaiswal
@aditya which compiler are you using

On Sun, Feb 6, 2011 at 10:21 PM, aditya pratap
wrote:

> i do'nt know why it is printing 556.
> could anyone give me the logic.
>
>
> Aditya Pratap
> MCA II
> Delhi University
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
With Regards,
*Jalaj Jaiswal* (+919019947895)
Final Year Undergraduate,
IIIT ALLAHABAD

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] o/p

2011-02-06 Thread aditya pratap
i do'nt know why it is printing 556.
could anyone give me the logic.


Aditya Pratap
MCA II
Delhi University

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] o/p

2011-02-06 Thread Gajendra Dadheech
i think it will be 34...

Thanks and regards,
Gajendra Dadheech




On Sun, Feb 6, 2011 at 10:15 PM, jalaj jaiswal wrote:

> @ranjane
> the value of i will not change as ++ptr will execute first.
> but i wonder if a char pointer can be used to store integer address... will
> it be an error ?
>
>
> On Sun, Feb 6, 2011 at 10:09 PM, ranjane  wrote:
>
>> what s the o/p of the followin pgm?
>>
>> main()
>> {
>> int i=300;
>> char *ptr;
>> ptr=&i;
>> *++ptr=2;
>> printf("%d",i);
>> }
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>>
>
>
> --
> With Regards,
> *Jalaj Jaiswal* (+919019947895)
> Final Year Undergraduate,
> IIIT ALLAHABAD
>
>   --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] o/p

2011-02-06 Thread jalaj jaiswal
@ranjane
the value of i will not change as ++ptr will execute first.
but i wonder if a char pointer can be used to store integer address... will
it be an error ?

On Sun, Feb 6, 2011 at 10:09 PM, ranjane  wrote:

> what s the o/p of the followin pgm?
>
> main()
> {
> int i=300;
> char *ptr;
> ptr=&i;
> *++ptr=2;
> printf("%d",i);
> }
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>


-- 
With Regards,
*Jalaj Jaiswal* (+919019947895)
Final Year Undergraduate,
IIIT ALLAHABAD

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] o/p

2011-02-06 Thread ranjane
what s the o/p of the followin pgm?

main()
{
int i=300;
char *ptr;
ptr=&i;
*++ptr=2;
printf("%d",i);
}

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] o/p of strlen()

2010-06-15 Thread Amir hossein Shahriari
you didn't put an '\0' at the end of the string
strlen looks for a '\0' in the string and here it happened to be 8
bytes after the starting position of s

On 6/15/10, mohit ranjan  wrote:
> Hi All,
>
> char s[]={'a', 'b', 'c', 'd'};
>
> printf("%d\n", strlen(s));
>
>
> o/p is 8
>
> can anybody plz explain why 8 ?
>
> Mohit
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algoge...@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] o/p of strlen()

2010-06-15 Thread mohit ranjan
Hi All,

char s[]={'a', 'b', 'c', 'd'};

printf("%d\n", strlen(s));


o/p is 8

can anybody plz explain why 8 ?

Mohit

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] o/p

2010-06-05 Thread divya jain
turbo c++ and my o/p is logical as well

On 5 June 2010 17:58, sharad kumar  wrote:

> @divya,which compiler u r using,i m getting this o/p on gcc compiler
>
> @mohit:loop stops at 4,294,967,295 in gcc
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algoge...@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] o/p

2010-06-05 Thread Rohit Saraf
If you make it unsigned short int.. then it goes to 65535 on g++/gcc
--
Rohit Saraf
Second Year Undergraduate,
Dept. of Computer Science and Engineering
IIT Bombay
http://www.cse.iitb.ac.in/~rohitfeb14

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] o/p

2010-06-05 Thread sharad kumar
@divya,which compiler u r using,i m getting this o/p on gcc compiler

@mohit:loop stops at 4,294,967,295 in gcc

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] o/p

2010-06-05 Thread mohit ranjan
@Sharad
i am getting ths o/p on gcc

1
2
3
4
...
...

which compiler you are using ?

Mohit Ranjan


On Sat, Jun 5, 2010 at 1:44 PM, sharad  wrote:

> #include
> int main()
> {
> short int i=0;
> for(i<=5&&i>=-1;++i;i>0)
> printf("%u\n",i);
> return 0;
> }
>
> o/p coming is 1...4,294,967,295
> short int is of 2 bytes
> can any one plzz explain the o/p
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algoge...@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] o/p

2010-06-05 Thread divya jain
output on my compiler is 165535
as i=0 initialy ++i is true and so for loop condition is true and printf is
executed. when i becomes 65535 then ++i is equal to 0 and so for loop
condition becomes false.

On 5 June 2010 13:44, sharad  wrote:

> #include
> int main()
> {
> short int i=0;
> for(i<=5&&i>=-1;++i;i>0)
> printf("%u\n",i);
> return 0;
> }
>
> o/p coming is 1...4,294,967,295
> short int is of 2 bytes
> can any one plzz explain the o/p
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algoge...@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] o/p

2010-06-05 Thread sharad
#include
int main()
{
short int i=0;
for(i<=5&&i>=-1;++i;i>0)
printf("%u\n",i);
return 0;
}

o/p coming is 1...4,294,967,295
short int is of 2 bytes
can any one plzz explain the o/p

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.