2000-07-22 11:14:00 +00:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
static const char S1[] = {
|
|
|
|
'h', 'e', 'l', 'l', 'o', ' ', 'W', 'o', 'r', 'l', 'd', '\0', 'A'
|
|
|
|
};
|
|
|
|
|
|
|
|
static const char S2[] = {
|
|
|
|
'h', 'e', 'l', 'l', 'o', ' ', 'w', 'o', 'r', 'l', 'd', '\0', 'B'
|
|
|
|
};
|
|
|
|
|
2020-07-13 19:26:07 +00:00
|
|
|
int fails = 0;
|
2000-07-22 11:14:00 +00:00
|
|
|
|
|
|
|
int main (void)
|
|
|
|
{
|
|
|
|
char I;
|
2020-07-13 19:26:07 +00:00
|
|
|
int ret;
|
2000-07-22 11:14:00 +00:00
|
|
|
for (I = 0; I < 20; ++I) {
|
2020-07-13 19:26:07 +00:00
|
|
|
ret = strncmp (S1, S2, I);
|
|
|
|
printf ("%02d: %d\n", I, ret);
|
|
|
|
if ((ret != 0) && (I < 7)) {
|
|
|
|
fails++;
|
|
|
|
}
|
2000-07-22 11:14:00 +00:00
|
|
|
}
|
2020-07-13 19:26:07 +00:00
|
|
|
printf("fails: %d\n", fails);
|
|
|
|
return fails;
|
2000-07-22 11:14:00 +00:00
|
|
|
}
|