[C언어 소스] 문자열 복사(strcpy_s 함수, strncpy_s 함수) #include #include #define MAX_NAME_LEN 50 int main() { char name1[MAX_NAME_LEN+1] = "hello"; char name2[MAX_NAME_LEN+1] = ""; char name3[MAX_NAME_LEN+1] = ""; strcpy_s(name2,sizeof(name2),name1); printf("%s\n",name2); strncpy_s(name3,sizeof(name3),name1,3); printf("%s\n",name3); return 0; } 실행 결과hello hel 본문[디딤돌 C언어] 72. 문자열 복사