C 语言实例 - 连接字符串
C 语言教程
· 2019-02-21 08:59:12
使用 strcat() 连接两个字符串。
实例
#include <stdio.h>
int main()
{
char s1[100], s2[100], i, j;
printf("输入第一个字符串: ");
scanf("%s", s1);
printf("输入第二个字符串: ");
scanf("%s", s2);
// 计算字符串 s1 长度
for(i = 0; s1[i] != '\0'; ++i);
for(j = 0; s2[j] != '\0'; ++j, ++i)
{
s1[i] = s2[j];
}
s1[i] = '\0';
printf("连接后: %s", s1);
return 0;
}
输出结果为:
输入第一个字符串: google 输入第二个字符串: codercto 连接后: googlecodercto
点击查看所有 C 语言教程 文章: https://codercto.com/courses/l/17.html
An Introduction to Probability Theory and Its Applications
William Feller / Wiley / 1991-1-1 / USD 120.00
Major changes in this edition include the substitution of probabilistic arguments for combinatorial artifices, and the addition of new sections on branching processes, Markov chains, and the De Moivre......一起来看看 《An Introduction to Probability Theory and Its Applications》 这本书的介绍吧!