指针, 指针的指针, 数组, 指针数组, 数组指针, 指针函数, 函数指针

来源:互联网 发布:怎样添加网络共享硬盘 编辑:程序博客网 时间:2024/04/28 05:09

--------------指针----------------
int a=10;
int *p=&a;

-------------指针的指针-----------
int b=20;
int *p=&b;
int **p2p=&p;


<script type="text/javascript"><!--google_ad_client = "pub-3555979289815451";google_ad_slot = "0437120238";google_ad_width = 468;google_ad_height = 60;//--></script><script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"></script>

-------------简单数组-----------------
int c[10];//整数数组,含有10个整数元素
          也就是说每一个元素都是整数
         
--------------指针数组--------------------
int *p[10];//指针数组,含有10个指针元素
            也就是说每一个元素都是指针
           
--------------数组指针--------------------
int (*p)[10];//数组指针,这个指针可以用来指向
             含有10个元素的整数数组 

 

------------函数指针---------------------

int   (*p)( ); // 指向函数的指针...这里声明了一个指针p,该指针指向返回值是整型(即函数类型为整型)的函数!  


----------------指针函数---------------------------

int   *p(int   a,float   b); //返回值为指针的函数...该函数返回指向整型变量的指针!

                                       即该函数的类型为int   *,  p和上例不同,他是函数名!上例中是指针!

 

原创粉丝点击