使用strncpy的是注意两点,目的是数组和目的是指针 1.目的是数组: char dest[N+1] = "abcde"; // char src[N+1] = "12345"; strncpy(dest,src,N); dest[N] ='