NULL Pointer Bugs

A NULL character pointer is NOT the same as a pointer to a NULL string. In Solaris, the following program will lead to a "Segmentation Fault".

  1. #include <stdio.h>
  2. #include <string.h>
  3. int main()
  4. {
  5.     char *string=NULL;
  6.     printf("/n String length=%d",strlen(string));
  7.     return 0;
  8. }

I don't know hwy this happens clearly now, and it should be pay more attention.