zoukankan      html  css  js  c++  java
  • C static struct

    参考链接:  http://blog.csdn.net/keyeagle/article/details/6708077/

    NOTICE: 

              静态全局变量 与 普通的全局变量的区别

              static 全局变量它只在定义它的源文件内有效,其他源文件无法访问它,  而普通全局变量可以通过 extern 方式使用全局变量

     struct:   用.name ="abc" 或  name:"abc"

          

    #include <stdio.h>
    
    #define uint64_t   int 
    #define uint32_t   int 
    
    
    struct mtd_partition {
        const char *name;       /* identifier string */
        uint64_t size;          /* partition size */
        uint64_t offset;        /* offset within the master MTD space */
        uint32_t mask_flags;        /* master MTD flags to mask out for this partition */
        // struct nand_ecclayout *ecclayout;   /* out of band layout for this partition (NAND only) */
    };
    
    
    #define MTDPART_OFS_APPEND   100
    
    int main(int argc, char const *argv[])
    {
        
        static struct mtd_partition ls1x_nand_partitions[] = {
        {
            .name   = "kernel",
            .offset = MTDPART_OFS_APPEND,
            .size   = 14*1024*1024,
        }, {
            .name   = "rootfs",
            .offset = MTDPART_OFS_APPEND,
            .size   = 100*1024*1024,
        }, {
            .name   = "data",
            .offset = MTDPART_OFS_APPEND,
            .size   = 100*1024*1024,
        },
    };
    
    
    static struct mtd_partition ls1x_nand_partitions1[] = {
        {
            name   : "kernel",
            offset : MTDPART_OFS_APPEND,
            size   : 14*1024*1024,
        }, {
            name   : "rootfs",
            offset : MTDPART_OFS_APPEND,
            size   : 100*1024*1024,
        }, {
            name   : "data",
            offset : MTDPART_OFS_APPEND,
            size   : 100*1024*1024,
        },
    };
    
    
    
    
    
      printf("%s
    ", ls1x_nand_partitions[0].name);
      printf("%s
    ", ls1x_nand_partitions1[0].name);
    
        return 0;
    }
  • 相关阅读:
    mysql-proxy使用中的问题
    iOS中利用CoreTelephony获取用户当前网络状态(判断2G,3G,4G)
    Django连接MySQL出错
    前后端分离
    django 安装指定版本
    问题
    算法面试
    记录docker for windows 时候的错误
    Django项目部署
    git 上传至github
  • 原文地址:https://www.cnblogs.com/hzijone/p/7007799.html
Copyright © 2011-2022 走看看