cs
#include <stdio.h>
void fun(char* a)
{
int m = 0, i = 0;
char* p;
p = a;
while (*p == '*')
{
m++;
p++;
}
while (*p != '\0')
{
a[i++] = *p;
p++;
}
while (m != 0)
{
a[i++] = '*';
m--;
}
a[i] = '\0';
}
void main()
{
char s[81]; int n = 0;
printf("Enter a string:\n"); gets(s);
fun(s);
printf("The string after moveing:\n"); puts(s);
}
输出结果: