|
|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
本帖最后由 Ghost_Scholar 于 2013-8-28 11:20 编辑
- #include <stdio.h>
- #include <malloc.h>
- #include <windows.h>
- void StrCat(char * lP,char * lQ);
- int main(void)
- {
- char * lP;
- char b[100];
- lP=(char *)malloc(sizeof(char)*10);
- gets_s(lP,10);
- scanf_s("%s",b,100);
- StrCat(lP,b);
- printf("%s", lP);
- free(lP);
- system("pause");
- return 0;
- }
- void StrCat(char * lP ,char * lQ)
- {
- int i;
- for(i=0;*lP != '\0'; i++)
- {
- lP++;
- }
- for (; *lQ != '\0'; lP++,lQ++)
- {
- *lP = *lQ;
- }
- *lP='\0';
- }
复制代码 求高手解决过界问题啊 在线等!~ |
|