Member access operators

From cppreference.com
< c‎ | language

Member access operators allow access to the members of their operands.


Operator Operator name Example Description
[] array subscript a[b] access the bth element of array a
* pointer dereference *a dereference the pointer a to access the data it points to
& address of &a the address of a
. struct member a.b access member b of struct a
-> struct member of pointer to struct a->b access member b of struct pointed to by a

equivalent of first dereferencing the pointer to the struct a then accessing member b:

(*a).b

[edit] See Also

Common operators
assignment increment
decrement
arithmetic logical comparison member
access
other

a = b
a += b
a -= b
a *= b
a /= b
a %= b
a &= b
a |= b
a ^= b
a <<= b
a >>= b

++a
--a
a++
a--

+a
-a
a + b
a - b
a * b
a / b
a % b
~a
a & b
a | b
a ^ b
a << b
a >> b

!a
a && b
a || b

a == b
a != b
a < b
a > b
a <= b
a >= b

a[b]
*a
&a
a->b
a.b

a(...)
a, b
(type) a
? :
sizeof
_Alignof
(since C11)