C语言中如何实现输入一个字符串再输出该字符串?

除了用数组。。。
很感谢一楼,已经成功,可应该如何才能实现输入两个,输出两个呢?
我用gets(p); puts(p);
gets(q); puts(q);
为什么第二个就没用了呢?

第1个回答  2010-05-17
#include <stdio.h>
#include <string.h>

void main()
{
char *p;

gets(p);
puts(p);

}

可应该如何才能实现输入两个,输出两个呢?
#include <stdio.h>
#include <string.h>

void main()
{
char *p,*q;

gets(p);
puts(p);

printf("\n");
gets(p);
q=p;
puts(q);

}本回答被提问者采纳
第2个回答  推荐于2018-03-21
用puts()直接输出本回答被网友采纳
第3个回答  2019-03-07
#include
<stdio.h>
#include
<string.h>
void
main()
{
char
*p;
gets(p);
puts(p);
}
可应该如何才能实现输入两个,输出两个呢?
#include
<stdio.h>
#include
<string.h>
void
main()
{
char
*p,*q;
gets(p);
puts(p);
printf("\n");
gets(p);
q=p;
puts(q);
}

相关了解……

你可能感兴趣的内容

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 非常风气网