E
Eric2
Consider this...
char abc[ 10 ] = "qwertyu"; // note abc doesn't get filled
int result = strcmp( &abc[1], "wer" );
"result" should evaluate to zero, right? (... comparing "wer" to the
contents of the string abc starting at position 1...)
It doesn't... it evaluates to 1.
For that matter...
int result = strcmp( abc, "qwe" );
.... also evaluates to 1.
If I say...
char *abc = "qwertyu";
.... strcmp still evaluates to 1 in both examples.
On the other hand...
int result = strncmp( &abc[1], "wer", 3);
.... evaluates to zero just like it should.
I think my computer is haunted...
char abc[ 10 ] = "qwertyu"; // note abc doesn't get filled
int result = strcmp( &abc[1], "wer" );
"result" should evaluate to zero, right? (... comparing "wer" to the
contents of the string abc starting at position 1...)
It doesn't... it evaluates to 1.
For that matter...
int result = strcmp( abc, "qwe" );
.... also evaluates to 1.
If I say...
char *abc = "qwertyu";
.... strcmp still evaluates to 1 in both examples.
On the other hand...
int result = strncmp( &abc[1], "wer", 3);
.... evaluates to zero just like it should.
I think my computer is haunted...