天天看點

strcat字元串拼接函數

摘自linux核心4.11.1源碼string.c

linux/lib/string.c

Copyright (C) 1991, 1992  Linus Torvalds

頭檔案:#include <string.h>

作用:字元串拼接函數,将字元串src拼接至dest目标存儲區

參數:

dest:目标存儲區

src:源字元串

傳回值:

dest 目标存儲區的位址

/**
 * strcat - Append one %NUL-terminated string to another
 * @dest: The string to be appended to
 * @src: The string to append to it
 */
 
char *strcat(char *dest, const char *src)
{
	char *tmp = dest;


	while (*dest)
		dest++;
	while ((*dest++ = *src++) != '\0')
		;
	return tmp;
}