zoukankan      html  css  js  c++  java
  • 《C和指针》 读书笔记 -- 第10章 结构和联合

    1.聚合数据类型能够同时存储超过一个的单独数据,c提供了两种类型的聚合数据类型,数组和结构。

    2.【1】

      struct SIMPLE {

        int a;

      };

      struct SIMPLE x;

     【2】

      typedef struct {

        int a;

      }Simple;

      Simple x;

    3.结构的自应用 --->用指针

      struct SELF_REF {

        int a;

        struct SELF_REF *b;

      };

    4.struct SIMPLE x;

      struct SIMPLE *p;

    =====>>>      x.a

                           p->a

    5.位段

      位段成员必须声明为int,signed int,unsigned int;成员名后面是一个冒号和一个整数,这个整数指定该位段所占用的位的数目。

      struct CHAR {

        unsigned ch    :7;

        unsigned font : 12;

      };

          struct CHAR ch1;

    6.联合(union)

      联合的所有成员引用的是内存中的相同位置,当你想在不同的时刻把不同的东西存储于同一个位置时,就可以用联合。

      union {

        float f;

        int i;

      }fi;

  • 相关阅读:
    jQuery实现“回到顶部”按钮功能
    围绕DOM元素节点的增删改查
    jQuery ajax
    对JSON的理解
    Replacing Accented characters(Diacritic) .NET
    全球主要城市经纬度api
    无标题
    Use Razor for Email Template outside ASP.NET MVC
    .NET and php
    knockoutjs
  • 原文地址:https://www.cnblogs.com/hello2mhb/p/3387903.html
Copyright © 2011-2022 走看看