帮我看看这个有什么问题?打印出来全是乱码。

victormaomao 2008-09-14 04:22:42
#include "stdafx.h"
#include <stdio.h>
#include <string>
#include <stdlib.h>
#include <ctype.h>

int main(int argc, char* argv[])
{
char szStr[100],chStr1[100],chStr8[100]="*";
fflush(stdin);
gets(szStr);
if (chStr1!='\0')
strcat(chStr1,chStr8);
puts(chStr1);

return 0;
}


//我想要实现的是:输入的数字字符串szStr与chStr8进行拼接。这个前提是数字字符串szStr不为空的时候进行拼接。为空时不执行拼接命令。
...全文
62 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
pointerfree 2008-09-14
  • 打赏
  • 举报
回复
建议你定义数组时 初始化一下
char szStr[100],chStr1[100],chStr8[100]="*";
memset(szStr,0,100);
memset(szStr1,0,100);

69,373

社区成员

发帖
与我相关
我的任务
社区描述
C语言相关问题讨论
社区管理员
  • C语言
  • 花神庙码农
  • 架构师李肯
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧