note 54593 added to function.strcmp
| From: | harry dot pool at boeing dot com | Date: | Fri, 08 Jul 2005 16:30:36 +0000 |
| Subject: | note 54593 added to function.strcmp | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-91683@lists.php.net to get a copy of this message | ||
I don't understand why an on-line exam question in a C course says I should have selected
"s1 less than s2" after
strcpy(s1, "machine");
strcpy(s2, "computer");
if (strcmp(s1, s2)==0
printf("equal\n);
else if (strcmp(s1, s2)<0)
printf("s1 less than s2\n");
else
printf("s1 greater than s2\n");
I selected "s1 greater than s2" because I expect 'm' > 'c'.
Unfortunately, I don't have a C compiler I can test with.
----
Manual Page -- http://www.php.net/manual/en/function.strcmp.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+54593
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+54593&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+54593&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+54593&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+54593&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+54593&report=yes&reason=non-english
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+54593&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+54593&report=yes
Search -- http://master.php.net/manage/user-notes.php