Some symbolic meaning of C language functions meaning

union: union / consortium

union {name union
member list
};

类似结构体,是一群变量的集合 and a different set is:

  1. When the common volume partitioning, according to the internal variable is assigned the maximum size of the variable.
    Below, double the maximum required 8byte, so 8 bytes allocated space
union data{
    int n;
    char ch;
    double f;
};
  1. In fact, only the space allocated union, regardless of any operation within the space
    as follows: The size of the space allocated good union internal variables can be written even undefined variable type
union var1{
        int a;
        double b;
};

int main()
{
        union var1 uu;
        uu.a=1;
        char* p1;
        p1  = &uu;
        p1[0] = 'a';
        p1[1] = 'b';
        p1[2] = '\0';
        printf("%s", &uu);
        return 0;
}

attribute : set a special property

attribute can be set property function (Function Attribute), variable attributes (Variable Attribute) and type attributes (Type Attribute)

+ Union attribute (( transparent_union )): Transparent joint

In fact, there may also be attribute ((transparent_union)), said that in order to prevent duplicate names

Transparent joint related presentations: https://gcc.gnu.org/onlinedocs/gcc-4.0.0/gcc/Type-Attributes.html#Type-Attributes

The effect of ##: Connector

An array of characters, character pointer

  • The value of the variable names stored in the memory array is the address of the first value of the array, so the array name is a pointer
  • An array of characters role is to store the string
  • Character pointer char*points to a string ends with 00 strings
  • So is the character pointer array of characters, namely char *==char []
//下面这样的赋值是可行的
char a[2] = "a";
char *b = a;
printf("first value is :%s", b);

char **argv == char *argv[]

Published 118 original articles · won praise 14 · views 50000 +

Guess you like

Origin blog.csdn.net/github_38641765/article/details/90554051