ptr_aray.cpp
来自「在c环境下的对数据结构进行讲解,包含有例题及答案」· C++ 代码 · 共 26 行
CPP
26 行
//ptr_aray.cpp
#include <iostream.h>
#include <conio.h>
void putstr_array(char *);
void putstr_ptr(char *);
void main()
{ char *str="This ia a books.";
putstr_array(str);
putstr_ptr(str);
getch();
}
//index s as array
void putstr_array(char *s)
{ for (int i=0;s[i];i++)
cout << s[i];
cout << endl;
}
//Access as a pointer
void putstr_ptr(char *s)
{ while (*s)
cout << *s++;
cout << endl;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?