C Tutorial/Structure/structure pointer
Using the structure member and structure pointer operators
<source lang="cpp">#include <stdio.h> struct card {
char *face; char *suit;
}; int main() {
struct card aCard; struct card *cardPtr; aCard.face = "Ace"; aCard.suit = "Spades"; cardPtr = &aCard; printf( "%s%s%s\n%s%s%s\n%s%s%s\n", aCard.face, " of ", aCard.suit, cardPtr->face, " of ", cardPtr->suit, ( *cardPtr ).face, " of ", ( *cardPtr ).suit ); return 0;
}</source>
Ace of Spades Ace of Spades Ace of Spades