C++程序设计张桦第3章string、vector、数组和指针课件教学.pptVIP

  • 1
  • 0
  • 约1.91万字
  • 约 99页
  • 2017-01-01 发布于广东
  • 举报

C++程序设计张桦第3章string、vector、数组和指针课件教学.ppt

PPT研究院 POWERPOINT ACADEMY * * * 3.4.3 指针变量的运算 【例 3.8】指针的解引用运算。 #include iostream #includestring using namespace std; int main( ) { string s(Hello World!); string *sp = s; cout *sp endl; // 输出:Hello World! *sp = goodbye;// 字符串s 的内容改成 goodbye string s2 (see you later.); sp = s2; // sp指向字符串s2 cout *sp endl; // 输出:see you later. return 0;} 运行结果: Hello World! see you later. 3.4.3 指针变量的运算 3.指针与数组 一个数组A在内存占据一块连续的内存单元,数组名A就是这块连续内存单元的首地址,数组元素根据元素的数据类型依次占据若干连续的内存单元,设有数组A、以及相同数据类型的指针p,若将数组名A赋给指针p(p =

文档评论(0)

1亿VIP精品文档

相关文档