習題11 4 字串的連線 15分

2021-10-04 00:00:59 字數 664 閱讀 9425

本題要求實現乙個函式,將兩個字串連線起來。

函式介面定義:

char *str_cat( char *s, char *t );

函式str_cat應將字串t複製到字串s的末端,並且返回字串s的首位址。

裁判測試程式樣例:

#include

#include

#define maxs 10

char *str_cat( char *s, char *t );

int main()

, str2[maxs] = ;

scanf("%s%s", str1, str2);

p = str_cat(str1, str2);

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

return 0;

/* 你的**將被嵌在這裡 */

輸入樣例:

abcdef

輸出樣例:

abcdef

abcdef

char

*str_cat

(char

*s,char

*t )

s[m+n]

='\0'

;return p;

}

習題11 4 字串的連線 15分

本題要求實現乙個函式,將兩個字串連線起來。函式介面定義 char str cat char s,char t 函式str cat應將字串t複製到字串s的末端,並且返回字串s的首位址。裁判測試程式樣例 include include define maxs 10 char str cat char s...

習題11 4 字串的連線 15分

本題要求實現乙個函式,將兩個字串連線起來。char str cat char s,char t 函式str cat應將字串t複製到字串s的末端,並且返回字串s的首位址。include include define maxs 10 char str cat char s,char t int main...

習題11 4 字串的連線 15分

本題要求實現乙個函式,將兩個字串連線起來。函式介面定義 char str cat char s,char t 函式str cat應將字串t複製到字串s的末端,並且返回字串s的首位址。裁判測試程式樣例 include include define maxs 10 char str cat char s...