本题要求编写函数,将输入字符串t中从第m个字符开始的全部字符复制到字符串s中。这样写为什么不对呢

#include <stdio.h>

#define MAXN 20

void strmcpy( char *t, int m, char *s );

void ReadString( char s[] );

/* 由裁判实现,略去不表 */

int main()

{

char t[MAXN], s[MAXN];

int m;

scanf("%d\n", &m);

ReadString(t);

strmcpy( t, m, s );

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

return 0;

}

这个是我写的

void strmcpy( char *t, int m, char *s )
{
    int b,c,i=0;
    while(t[i])
    {
        i++;
    }
    if(m>i) *s='\0';
    else{
    for(b=0;c<=i;c++)
    {
        c=m-1;
        s[b]=t[c];
        b++;
    }
    }
    return ;
}

在for循环中b++的下面添上m++;就对了。

c没有赋初值