这个程序总是能运行,就是会出现窗口”Debug error“,这是怎么了?
#include "stdafx.h"
#include<stdio.h>
#include<conio.h>
#include<malloc.h>
char *linkStr(char *s1,char *s2){
char *s3;
int len1=0,len2=0;
char *p,*p3;
p=s1;
while (*p++);
len1=p-s1-2;
p=s2;
while (*p++);
len1=p-s2-2;
s3=(char*)malloc(len1+len2+1);
p=s1;p3=s3;
while(*p)(*p3++)=(*p++);
p=s2;
while(*p)(*p3++)=(*p++);
*p3 = '\0';
return s3;
}
int main(int argc, char* argv[])
{
char *s1="dfasegaerg";
char *s2="36837413431";
puts(linkStr(s1,s2));
free(linkStr(s1,s2));
getch ();
return 0;
}