in a strcmp statement if the 2 strings are equal is it the condition of true or false i.e 1 or 0,i always get confused with this,wanna get cleared atleast now.
if(strcmp(str1,str2)>0)---------> wat does dis >0 imply?
c in both strings u r traversing from left to rite let elements of str1 be ai and tht of str2 be bi now for each i it goes on checkin which is greater...for the 1st such i found it returns>0 if ai>bi and <0 for ai<bi
eg computer(str1) n commander(str2) now a0=b0,a1=b1,a2=b2 buta3>b3 hence returns >0 for strcmp(str1,str2)
but if u had given strcmp(str2,str1) the same eg as above will return <0 as the second string(str1) is greater in terms of the idea ive expressed above
let elements of str1 be ai and tht of str2 be bi
now for each i it goes on checkin which is greater...for the 1st such i found it returns>0 if ai>bi and <0 for ai<bi
eg computer(str1) n commander(str2)
now a0=b0,a1=b1,a2=b2 buta3>b3
hence returns >0 for strcmp(str1,str2)
but if u had given strcmp(str2,str1)
the same eg as above will return <0 as the second string(str1) is greater in terms of the idea ive expressed above