c语言指针

源程序:

#include <stdio.h>
#include <iostream>
#include <stdlib.h>
using namespace std;
int main()
{
char* p;
char a[80];
p = a;
int i = 0;
while((*p=getchar())!='\n')
{
p++;
i++;
}
a[i] = '\0';
for (p = a; *p!='\0';)
{
cout<<*p;
p++;
}
return 1;
}

 

运行结果:

 

posted @ 2023-10-20 15:20  bobo哥  阅读(20)  评论(0编辑  收藏  举报