mikroElektronika PIC Microcontrollers PIC12 User Manual page 85

Mikroc user's manual
Table of Contents

Advertisement

mikroC
making it simple...
Structure Member Access
Structure and union members are accessed using the following two selection oper-
ators:
(period)
.
->
The operator
one of the structure's members. Suppose that the object
if
m
s.m
is of type
The operator
ps
expression
ps->m // indirect access to member m;
is of type
convenient shorthand for
For example:
struct mystruct {
int i; char str[10]; double d;
} s, *sptr = &s;
s.i = 3;
sptr -> d = 1.23;
The expression
type. The expression
MikroElektronika: Development tools - Books - Compilers
(right arrow)
is called the direct member selector and it is used to directly access
.
is a member identifier of type
// direct access to member m
, and represents the member object
M
is called the indirect (or pointer) member selector. Suppose that
->
is a pointer to
. Then if
s
// identical to (*ps).m
, and represents the member object m in
M
(*ps).m
.
.
.
// assign to the i member of mystruct s
// assign to the d member of mystruct s
is an lvalue, provided that
s.m
sptr->m
mikroC - C Compiler for Microchip PIC microcontrollers
declared in
, the expression
M
s
in
m
is a member identifier of type
m
.
is an lvalue and
s
is an lvalue unless
m
is of struct type
s
.
s
declared in
M
. The expression
s
ps->m
is not an array
m
is an array type.
. Then
S
, the
s
is a
page
77

Hide quick links:

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the PIC Microcontrollers PIC12 and is the answer not in the manual?

This manual is also suitable for:

Pic microcontrollers pic16Pic microcontrollers pic18

Table of Contents