学习日记(字符串处理函数小知识strxxx)

错误原因:在标准C库的字符串处理函数 strxxx 一系列函数中,对参数传入NULL将会导致程序崩溃。

#include <stdio.h>
#include <string.h>
int main()
{
  char s[10];
  strlen(NULL);  //程序崩溃
  strcmp(s,NULL);  //程序崩溃
  strcpy(s,NULL);  //程序崩溃
  return 0;    
}
原文地址:https://www.cnblogs.com/zhi321/p/11566889.html