Cutton Eye
Cutton Eye

Reputation: 3559

Asterisk in the definition of a struct

What does the asterisk (*) do in the end of the struct definition? Is this the definition to a pointer of a unnamed struct?

riscv.c (from openOCD-Project: src/target/riscv/riscv.c:195)

struct {
    uint16_t low, high;
} *expose_csr;

Upvotes: 0

Views: 290

Answers (1)

unwind
unwind

Reputation: 399763

Yes, that's a definition of a pointer to an unnamed structure. This can be quite useful for structures that are only ever referenced through that pointer, since it makes it impossible to create an instance statically for instance.

Upvotes: 1

Related Questions