When the strings are equal then strcmp returns zero so your condition will become if (0). In order to correct it use
if(strcmp(str1,str2)==0) pritnf("equal"); else Unequal. On Tue, Aug 2, 2011 at 7:47 PM, Vijay Khandar <vijaykhand...@gmail.com>wrote: > #include<stdio.h> > #include<conio.h> > #include<string.h> > void main() > { > clrscr(); > char str1[]="Hello"; > char str2[]="Hello"; > int i; > if(strcmp(str1,str2)) > printf ("\n Equal"); > else > printf("\n Unequal"); > getch(); > } > > Plz anyone explain me o/p with explanation................. > > Vijay........ > > -- > 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. > > -- Prateek Gupta 7th sem, Information Technology, Netaji Subhas Institute Of Technology 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.