strcmp 函数库中的声明:
int __cdecl strcmp (
const char * src,
const char * dst
)
#include<string.h>
#include<stdio.h>
int main( void )
{
char *s1 = "abcdkkkd";
char *s2 = "oefjeofjefo";
printf( "%d", strcmp( &s1, &s2 ) );
return 0;
}
程序为什么会正常运行?
天蓬老师2017-04-17 14:25:29
int strcmp( const char *lhs, const char *rhs );
Function declaration, c99 is slightly different from c11, but it does not affect it.
What is passed in is a pointer. Even if a string variable is passed in, it is still an address.
compares the strings starting from the pointer address to the null character