首页 > 其他 > 详细

读书共享 Primer Plus C-part 9

时间:2017-07-05 19:30:32      阅读:252      评论:0      收藏:0      [点我收藏+]

第十二章 存储类、链接和内存管理

 

技术分享技术分享

技术分享技术分享

技术分享

技术分享                                                     技术分享

 

                            技术分享

 

  •  针对代码块中的static变量做如下范本

           技术分享

 1 #include<stdio.h>
 2 
 3 void test_static()
 4 {
 5  int dy = 1;
 6  static int static_int =1;
 7  printf("%d %d \n",dy++,static_int++);
 8 
 9 }
10 
11 
12 int main()
13 {
14   int i = 0;
15   for(;i<5;i++)
16   {
17 
18   test_static();
19   }
20 
21 
22 }
  •          const与volatitle

    

 1 #include<stdio.h>
 2 
 3 int main()
 4 {
 5  int array[100] = {0};
 6  int array_2[100] = {0};
 7  int * const  p = array;
 8  const int *q =p;
 9  p = array_2;
10 
11 
12 }

技术分享

    区分const int *p; int * const p

    volatile 与const 是相对的

             

        

 

读书共享 Primer Plus C-part 9

原文:http://www.cnblogs.com/liuchuanwu/p/7122907.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!