错误原因:在标准C库的字符串处理函数 strxxx 一系列函数中,对参数传入NULL将会导致程序崩溃。
#include <stdio.h> #include <string.h> int main() { char s[10]; strlen(NULL); //程序崩溃 strcmp(s,NULL); //程序崩溃 strcpy(s,NULL); //程序崩溃 return 0; }