[algogeeks] output

2011-08-05 Thread ranjane
# define swap(a,b) temp=a; a=b; b=temp;
main( )
{
int i, j, temp;
i=5;
j=10;
temp=0;
if( i  j)
swap( i, j );
printf( “%d %d %d”, i, j, temp);
}


On compiling i got ans 10, 0, 0.explain..

-- 
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] output

2011-08-05 Thread loka ranjane
@saurabh:ya got it..thanks

On Sat, Aug 6, 2011 at 10:26 AM, saurabh singh saurab...@gmail.com wrote:
 Try compiling with gcc -E filename.c.That will clear everything

 On Sat, Aug 6, 2011 at 10:25 AM, saurabh singh saurab...@gmail.com wrote:

 hint:MACRo is just substituted as it is

 On Sat, Aug 6, 2011 at 10:23 AM, ranjane ranjane...@gmail.com wrote:

 # define swap(a,b) temp=a; a=b; b=temp;
 main( )
 {
 int i, j, temp;
 i=5;
 j=10;
 temp=0;
 if( i  j)
 swap( i, j );
 printf( “%d %d %d”, i, j, temp);
 }


 On compiling i got ans 10, 0, 0.explain..

 --
 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.




 --
 Saurabh Singh
 B.Tech (Computer Science)
 MNNIT ALLAHABAD





 --
 Saurabh Singh
 B.Tech (Computer Science)
 MNNIT 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.



[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.



[algogeeks] Re: o/p

2011-02-06 Thread ranjane
thank u jalaj

On Feb 6, 10:03 pm, jalaj jaiswal jalaj.jaiswa...@gmail.com wrote:
 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
 contacttoadity...@gmail.comwrote:

  @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.