strncpy란?
문자열의 일부만 복사하는 함수
strncpy(목적지, 원본, 복사할_글자수);
기본 예제
char str[20] = "mango tree";
strncpy(str, "apple-pie", 5); // 5글자만 복사
printf("%s\n", str); // 결과: "apple tree"
동작 과정:
원본: "mango tree"
복사: "apple" (5글자만)
결과: "apple tree"
↑↑↑↑↑
덮어씀

