【发布时间】:2011-07-30 07:42:14
【问题描述】:
为什么strcpy() 接受字符数组指针,即使strcpy 的定义是
char * strcpy( char * , const char * )??
#include <stdio.h>
#include <string.h>
main()
{
char str[] = "Have A Nice Day";
char ptr[17];
strcpy(ptr, str);
printf("%s", ptr);
}
【问题讨论】:
-
我猜 OP 是在询问
const而不是数组 vs 指针