<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.arm.com/utility/feedstylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>strcmp</title><link>https://community.arm.com/developer/tools-software/tools/f/keil-forum/18122/strcmp</link><description> In the example provided here, the strings are of different. I just wanted to ask what happens when at some index the array elements differ 
 
as in 
 
char * str1 = &amp;quot;Hello&amp;quot;;
 
and 
 
char * str2 = &amp;quot;Helio&amp;quot;;
 
and I do 
 
j = strcmp(str1, str2);
 
 
Will</description><dc:language>en-US</dc:language><generator>Telligent Community 10</generator><item><title>RE: strcmp</title><link>https://community.arm.com/thread/111157?ContentTypeID=1</link><pubDate>Thu, 18 Nov 2004 01:25:55 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:f076abbe-5514-4422-bc30-b4e2e9012dca</guid><dc:creator>Affan Rauf</dc:creator><description>&lt;p&gt;Thanks,&lt;br /&gt;
&lt;br /&gt;
That was exactly what I was asking. I wanted to use the return values of  &lt;b&gt;strcmp&lt;/b&gt; for sorting strings.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: strcmp</title><link>https://community.arm.com/thread/96707?ContentTypeID=1</link><pubDate>Fri, 12 Nov 2004 08:38:47 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:b17917af-3c48-421b-8998-44fdd666caa6</guid><dc:creator>John Donaldson</dc:creator><description>&lt;p&gt;&amp;quot;Less in length? Less in what?&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Less lexicographically.&lt;br /&gt;
&lt;br /&gt;
Here&amp;#39;s the source from a well known C library implementation:&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;
int strcmp(char * src, char * dest)
{
   int ret = 0 ;

   while(!(ret=*(unsigned char *)src-
   *(unsigned char *)dest) &amp;amp;&amp;amp; *dest)
   {
      ++src;
      ++dest;
   }

   if(ret&amp;lt;0)
      ret = -1 ;
   else
      if(ret&amp;gt;0)
         ret=1;

   return(ret);
}
&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: strcmp</title><link>https://community.arm.com/thread/86992?ContentTypeID=1</link><pubDate>Fri, 12 Nov 2004 05:48:49 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:96462cc1-2bf6-467b-a3c8-4dcd791bf7f2</guid><dc:creator>Oleg Sergeev</dc:creator><description>&lt;p&gt;hi,&lt;br /&gt;
&lt;br /&gt;
Stefan, I think that Affan means what does the &amp;quot;string1 is less than string2&amp;quot; means? Less in length? Less in what?&lt;br /&gt;
&lt;br /&gt;
Thanks,&lt;br /&gt;
Oleg&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: strcmp</title><link>https://community.arm.com/thread/43129?ContentTypeID=1</link><pubDate>Fri, 12 Nov 2004 05:37:40 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:b5dfe505-7c71-4d20-8de8-be89bf69d112</guid><dc:creator>John Donaldson</dc:creator><description>&lt;p&gt;&amp;quot;Will strcmp return the difference of ASCII&amp;#39;s of the differing characters?&amp;quot;&lt;br /&gt;
&lt;br /&gt;
To save you the effort I&amp;#39;ve looked it up in the manual for you:&lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://www.keil.com/support/man/docs/c51/c51_strcmp.asp"&gt;http://www.keil.com/support/man/docs/c51/c51_strcmp.asp&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>