strcpy和strncpy的区别
strcpy:字串复制原型:char *strcpy(char *dest, char *src);strncpy:字串复制原型:char * strncpy(char *dest, char *src, size_t n);区别范例:www.zzzyk.comchar ch[7] = "steven";char ch1[5];strcpy(ch1, ch); //出错,给定长度不够,导致内存泄露strncpy(ch1, ch, sizeof(ch1));//正确,动态计算长度
补充:软件开发 , C++ ,