Diferença de stricmp e _stricmp no Visual Studio?
Eu posso fazer uma pergunta estúpida, mas eu realmente não consigo encontrar uma resposta com o google e eu ainda sou um iniciante no uso do MSVS.
Eu recentemente preciso usar funções para fazer comparação de duas seqüências de caracteres. O que eu não entendo é a diferença de stricmp e _stricmp. Ambos podem ser usados para comparar strings e retornar os mesmos resultados. Eu fui verificá-los:
char string1[] = "The quick brown dog jumps over the lazy fox";
char string2[] = "The QUICK brown dog jumps over the lazy fox";
void main( void )
{
char tmp[20];
int result;
/* Case sensitive */
printf( "Compare strings:\n\t%s\n\t%s\n\n", string1, string2 );
result = stricmp( string1, string2 );
if( result > 0 )
strcpy( tmp, "greater than" );
else if( result < 0 )
strcpy( tmp, "less than" );
else
strcpy( tmp, "equal to" );
printf( "\tstricmp: String 1 is %s string 2\n", tmp );
/* Case insensitive */
result = _stricmp( string1, string2 );
if( result > 0 )
strcpy( tmp, "greater than" );
else if( result < 0 )
strcpy( tmp, "less than" );
else
strcpy( tmp, "equal to" );
printf( "\t_stricmp: String 1 is %s string 2\n", tmp );
}
resultado mostra que eles são os mesmos:
Compare strings:
The quick brown dog jumps over the lazy fox
The QUICK brown dog jumps over the lazy fox
stricmp: String 1 is equal to string 2
_stricmp: String 1 is equal to string 2
Eu estou querendo saber porque ...