int arr[]={6,7,8,9,10};int*ptr=arr;// *(ptr++)+=123;//等於兩句*(ptr)+=123;
ptr++;for(int i=0;i<5;i++){printf("%d\n",arr[i]);}printf("%d\n",*ptr);printf("%d,%d\n",*ptr,*(++ptr));return0;
c++引用
#include<iostream>usingnamespace std;int main (){// 聲明簡單的變量int i;double d;// 聲明引用變量int& r = i;double& s = d;
i =5;
cout <<"Value of i : "<< i << endl;
cout <<"Value of i reference : "<< r << endl;
d =11.7;
cout <<"Value of d : "<< d << endl;
cout <<"Value of d reference : "<< s << endl;return0;}
Value of i :5
Value of i reference :5
Value of d :11.7
Value of d reference :11.7