Discussion :: Strings - General Questions (Q.No.2)
|Yag said: (Jun 6, 2011)|
|I think it will return 1.|
|Sundar said: (Jul 9, 2011)|
|Returns an integral value indicating the relationship between the strings:
A zero value indicates that both strings are equal.
A value greater than zero indicates that the first character that does not match has a greater value in str1 than in str2; And a value less than zero indicates the opposite.
|Deepu said: (Sep 3, 2011)|
|String compares compare two string if they are same it will return 1 else return 0. Any one give more explanation.|
|Ankit said: (Sep 12, 2011)|
|What Sundar said is correct.|
|Shri said: (Dec 9, 2011)|
|When you compare any two strings at that time compiler will return 0.
And this logic is used to find palindrome string.
|Vinod said: (Jan 7, 2012)|
|Sanjay said: (Nov 7, 2012)|
|If both the strings are equal then it returns 1 otherwise 0.|
|Jagdish said: (Feb 16, 2014)|
|@Sunder is right. It will return only 0 when both string are similar otherwise it will return 1 or -1.|
|Suganthy said: (Mar 6, 2016)|
|Yes @Sundar is right, don't confuse yourself by searching answer for it.|
|Sowmi said: (Jul 19, 2016)|
|It returns 0. Given answer is correct.|
|Uday said: (Sep 16, 2016)|
|Actually there is a pointer function before strings. So if we give equal values to both strings but address are different, because strings are different.|
|Jaimin Kathrotiya said: (Nov 29, 2016)|
|Yes, It returns zero.|
|Devi Achsah said: (Jul 25, 2017)|
|Why they used const keyword in the argument?|
|Sandhya said: (Aug 30, 2017)|
|I think if string1>string2 it will return +ve.
string1<string it will return -ve.
string1=string it will return 0.
Post your comments here:
Email : (optional)
» Your comments will be displayed only after manual approval.