字符串加空格

#include "stdafx.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#define N 100
void Insert(char s[]);
int main()
{
 char str[N];
 printf_s("input a string:");
 gets_s(str);
 Insert(str);
 printf_s("Insert results:%s ",str);
 system("pause");
 return 0;
}
void Insert(char s[])
{
 char t[N];
 int i,j;
 strcpy_s(t,s);
 for(i = 0, j =0 ; t[i] != '';i++,j++)
 {
  s[j] = t[i];
  j++;
  s[j] = ' ';
 }
 s[j] = '';
}

原文地址:https://www.cnblogs.com/joyclub/p/4422584.html