zoukankan      html  css  js  c++  java
  • 读书共享 Primer Plus C-part 9

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

                                                         

                                

    •  针对代码块中的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 
    ",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 是相对的

                 

            

  • 相关阅读:
    计算几何
    差三角
    约瑟夫
    字符编码
    河南省赛之Substring
    移动字母
    抽屉原理
    不要为了完成代码而写代码
    分布式文件系统优化
    降低代码的复杂度
  • 原文地址:https://www.cnblogs.com/liuchuanwu/p/7122907.html
Copyright © 2011-2022 走看看