C语言:指针实现输出梯形字符串

用指针实现,实现过程无需将子串复制到一个新的字符串中。(10分)

题目内容:

用指针实现,实现过程无需将子串复制到一个新的字符串中。

输入格式:

字符串

输出格式:

子串

输入样例:

computer

输出样例:

computer

omputer

mputer

puter

uter

ter

er

r

code

#include "stdio.h"
int main()
{
	char s[30];
	char * p =s;
    scanf("%s",p);
    int i;
	for (i=0;i<sizeof(p);i++)
	{
		printf("%s\n",p+i );
	}
	return 0;	
}

  

猜你喜欢

转载自www.cnblogs.com/songqingbo/p/9009858.html