连续gets函数出错问题
大师们帮我看看这边是哪里出错了 ,为什么编译不出来呢。。#include<stdio.h>
#include<string.h>
char mystrncpy(char *s1,char *s2,int n);
int main()
{
char *p,*d;
int i;
gets(p);
printf("please enter the other centence:\n");
gets(d);
printf("ok,now please enter the number that you want to copy:\n");
scanf("%d",&i);
mystrncpy(p,d,i);
}
char mystrncpy(char *s1,char *s2,int n)
{
int i;
if(strlen(s2)<n)
strcpy(s1,s2);
else
{
for(i=0;i<strlen(s2);i++)
s1[strlen(s1)+i]=s2[i];
s1[strlen(s1)+i]='\0';
}
puts(s1);
}