一个字符串处理问题
请路过的高手帮我看看问题的症结,小弟先谢谢了。#include"stdio.h"
void main()
{
int n,m;
char string1[50],string2[50],*p;
p=string1;
int length(char *p);
printf("please input string1:");
gets(string1);
n=length(string1);//测量字符串的长度
int comp(int n,int m,char string1[],char string2[]);
scanf("%d",&m);
comp(n,m,string1,string2);//将第m个字符开始的全部字符复制成为另一个字符串
printf("the final results are:");
printf("%s",string2);
}
int length(char *p)
{
int i;
while(*p!='\0')
{
i++;
p++;
}
return i;
}
void comp(int n,int m,char string1[],char string2[])
{
char *p1,*p2;
p1=string1;
p2=string2;
if(m==0)
{
while(*p1)
*p2++=*p1++;
*p2='\0';
}
for(p2=p1+m;p2<p1+n;p2++)
*p2=*p1;
*p2='\0';
}
Compiling...
1.cpp
Linking...
1.obj : error LNK2001: unresolved external symbol "int __cdecl comp(int,int,char * const,char * const)" (?comp@@YAHHHQAD0@Z)
Debug/333.exe : fatal error LNK1120: 1 unresolved externals
执行 link.exe 时出错.