#include <iostream>
using namespace std;

int main()
char s1[10]="Pokemon",s2[10]="Pikachu",s3[10]="Raichu";

cout<<"B= "<<strcmp(s1,s2)<<endl;
cout<<"C= "<<strncmp(s1,s2,1)<<endl;
cout<<"D= "<<strcmp(&s2[4],&s3[3])<<endl;

return 0;
Anyone can explain to me.
B= 6
C= 0
D= 0
Please read the description of strcmp and strncmp. Then tell us what you think the answers should be and why.
Topic archived. No new replies allowed.