#include
#include
Int main ()
{
Char str1 []="hello";
Char str2 [2] [6]={" heasdqerecto ", "world"};
Int n1, and n2;
//n1=STRNCMP (str1, * str2 + 2, 4);
N2=STRNCMP (str1, * str2 + 1, 5);
//printf (" % d \ n % d ", n1, and n2);
Printf (" % d ", n2);
return 0;
}
Is intended to test, how to checked against hard-coded values using the STRNCMP is a two dimensional array of strings, there was an obvious question, but now the result is not clear where the problem is, at the answer, thank you,
CodePudding user response:
Char str2 [2] [6]={" heasdqerecto ", "world"}; This definition is, [2] [6] said the two strings are no more than 6 characters.Int main ()
{
Char str1 []="hello";
Char str2 [2] [6]={" heasd ", "world"};
Int n1, and n2;
N1=STRNCMP (str1 str2 [0], 5);
N2=STRNCMP (str1 str2 [1], 5);
Printf (" % d % d ", n1, and n2);
return 0;
}
CodePudding user response:
I hope it can help you: https://blog.csdn.net/it_xiangqiang/category_10581430.html
I hope it can help you: https://blog.csdn.net/it_xiangqiang/category_10768339.html