重学C++ 数组和指针的关系
来源:互联网 发布:淘宝促销广告语 编辑:程序博客网 时间:2024/06/06 01:06
//源程序来自《C++程序员教程》
#include<iostream>using std::cout;using std::endl;int main(){int b[]={10,20,30,40};int *bPtr=b;cout<<"Array b printed with:\n\n";cout<<"Array subscript notation\n";for(int i=0;i<4;i++){cout<<"b["<<i<<"]="<<b[i]<<"\n";}cout<<endl;cout<<"pointer\n";for(int offset1=0;offset1<4;offset1++){cout<<"*(b+"<<offset1<<")="<<*(b+offset1)<<"\n";}return 0;}
#include<iostream>using std::cout;using std::endl;void copy1(char*,const char*);void copy2(char*,const char*);int main(){char string1[10];char *string2="Hello";char string3[10];char string4[]="Good Bye";copy1(string1,string2);cout<<"string1="<<string1<<endl;copy2(string3,string4);cout<<"string3="<<string3<<endl;return 0;}void copy1(char* s1,const char* s2){for(int i=0;(s1[i]=s2[i])!='\0';i++){}}void copy2(char* s1,const char* s2){for(;(*s1=*s2)!='\0';s1++,s2++){}}
- 重学C++ 数组和指针的关系
- C/C++ --数组和指针的关系
- C语言中指针数组和数组指针的关系
- 重学C++ (二) 数组和指针
- 征服C指针之数组和指针的微妙关系
- 指针数组和数组指针的关系
- 重学c++:函数和数组
- 【重学《C++Primer第四版》】第四章、数组和指针
- 理解C语言指针和数组的关系的代码
- 指针与数组【重学C之五】
- C/C++中数组和指针类型的关系
- c语言,指针和数组大小之间的关系
- c语言中数组中的地址和指针的关系
- C语言二维数组和指针的关系
- c/c++ 函数、常量、指针和数组的关系梳理
- C语言基础-指针和数组的关系17
- C语言中数组名和指针的关系
- 数组和指针的关系
- JSON解析-android平台3
- UVa 10673 Play with Floor and Ceil ACM——数论 (扩展欧几里得算法)
- java中volatile关键字
- 2012年阿里巴巴c++笔试
- 8种排序算法及其稳定性
- 重学C++ 数组和指针的关系
- 同步和异步与阻塞和非阻塞的区别
- 有关automake的用法
- 黄金1小时线交易法(黄金高胜算交易)
- 唐僧那么无能,为什么能领导孙悟空呢?
- iphone之sqlite3
- Delphi中ADO查询多表更新单表解决方法
- windows调试器之windbg
- 发生在我身上的囧事(持续更新)