What does "->" mean in C language?
"->" is a whole in C language. This symbol is used to point to the pointer to the sub-data in the structure, and the sub-data can be taken out. The usage method is first in C language Define a structure; then declare a pointer pointing to the structure; and finally use the symbol to point to the corresponding sub-data name.
Usage examples
/*定义结构体*/ struct Data { int a,b,c; }; /*定义结构体指针*/ struct Data * p; /*声明变量A*/ struct Data A = {1,2,3}; /*声明一个变量x*/ int x; /*让p指向A*/ p = &A ; /*这句话的意思就是取出p所指向的结构体中包含的数据项a赋值给x*/ x = p->a; /*由于此时p指向A,因而 p->a == A.a,也就是1*/
Recommended tutorial: "C#"
The above is the detailed content of What does '->' mean in C language?. For more information, please follow other related articles on the PHP Chinese website!