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