1. 程式人生 > >用指標求字串逆序

用指標求字串逆序

#include <stdio.h>
#include<stdlib.h>
int main()
{
	char *p;
	int i=0;
	int count=0;
	char s[10];
	printf("Input:");
	p=s;
	gets(s);
	while(*p!='\0')
	{
		p++;
		count++;
	}
	while((count-1)>=0)
	{
		p--;
		printf("%c  ",*p);
		count--;
	}
	system("pause");
}