C_C++/C_라이브러리_함수

(C언어) strncat: 문자열을 일부를 다른 문자열에 추가한다

고니자니 2023. 3. 2. 14:52
반응형
#include <string.h>
char *strncat(char *dest, const char *src, size_t maxlen);

strncat 함수는 문자열 src의 일부를 문자열 dest에 추가합니다.

src에서 maxlen 개의 문자를 dest에 추가하고 NULL도 추가합니다.

 

참고: strcat

 

#define _CRT_SECURE_NO_WARNINGS  // Visual Studio
#include <stdio.h>
#include <string.h>
int main()
{
	char s[100] = "C,C++,";
	char s2[] = "C#,Java,Python";

	strncat(s, s2, 7);

	printf("%s\n", s);

	return 0;
}

strncat: 문자열의 일부를 추가한다

 

 

728x90
반응형