add.c

来自「<B>Digital的Unix操作系统VAX 4.2源码</B>」· C语言 代码 · 共 25 行

C
25
字号
/* add.c - concatenate two strings in managed memory */#include "../h/mh.h"#include <stdio.h>char   *add (this, that)register char  *this,               *that;{    register char  *cp;    if (!this)	this = "";    if (!that)	that = "";    if ((cp = malloc ((unsigned) (strlen (this) + strlen (that) + 1))) == NULL)	adios (NULLCP, "unable to allocate string storage");    (void) sprintf (cp, "%s%s", that, this);    if (*that)	free (that);    return cp;}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?