C语言字符串分割 与 合并

空格分割

输入:

	char a[20], b[20], c[20], d[100];
	const char *p = "hello : 20191227";
	sscanf(p, "%s %s %s", a, b, c);
	printf("--%s\n--%s\n--%s\n", a, b, c);
	printf("%s\n",p);
	sprintf(d, "%s %s %s", a , b ,c);
	printf("%s\n",d);

输出:

发布了144 篇原创文章 · 获赞 58 · 访问量 22万+

猜你喜欢

转载自blog.csdn.net/qqyuanhao163/article/details/103726971
今日推荐