It is basically comparing the addresses  of the two and since p contains the
memory address of "persons" it gives the output as technical persons...
infact ull be surprised to see dis

#include<stdio.h>
main(){char p[]="persons";char q[]="persons";if(p==q)printf
<http://www.opengroup.org/onlinepubs/009695399/functions/printf.html>("technical
%s",p);elseprintf
<http://www.opengroup.org/onlinepubs/009695399/functions/printf.html>("true
%s",p);return 0;}

output : true persons


#include<stdio.h>
main(){char *p="persons";char *q="persons";if(p==q)printf
<http://www.opengroup.org/onlinepubs/009695399/functions/printf.html>("technical
%s",p);elseprintf
<http://www.opengroup.org/onlinepubs/009695399/functions/printf.html>("true
%s",p);return 0;

}
bt Here output will be Technical persons
On Tue, Sep 6, 2011 at 9:04 PM, sivaviknesh s <sivavikne...@gmail.com>wrote:

>
> main()
> {
> char *p="persons";
> clrscr();
> if(p=="persons")
> printf("technical %s",p);
> else
> printf("true %s",p);
> return 0;
> }
>
> ..op : technical persons ..plz explain .. how come it works like an strcmp
> operation???
> --
> Regards,
> $iva
>
>  --
> 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.
>



-- 
Aditi Garg
Undergraduate Student
Electronics & Communication Divison
NETAJI SUBHAS INSTITUTE OF TECHNOLOGY
Sector 3, Dwarka
New Delhi

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

Reply via email to