code/C
문자열 복사하기
Lyla.
2023. 11. 5. 00:07
#define _CRT_SECURE_NO_WARNINGS // strcpy 보안 경고로 인한 컴파일 에러 방지
#include <stdio.h>
#include <string.h>
int main(void)
{
char s1[10] = "hello"; // 크기가 10인 char형 배열을 선언하고 문자열 할당
char s2[10];
strcpy(s2,s1);
printf("%s\n",s2);
return 0;
}