#Meta-Wlp: #Macro: TITLE wlp: Learn C (5) p. 4 #Eval: $TITLE$ #Macro: PAGE bb5-4

So you know all about structure tags.

A structure tag lets you use the structure in several declarations, having defined in just once. But you have to use the long format struct tagname. Tag names don't get confused with most other names for that reason - they are always used together with the struct keyword.

What happens here:

#include<stdio.h>

int main(int argc, char * argv) {
  struct name { 
    char * first ; 
    char * last ; } ;

  struct name n1 = { "dylan", "thomas" } ;

  printf("%s %s\n", n1.first, n1.last ) ;
}
#Shuffle: none $PAGE$-A $PAGE$-B $PAGE$-C Return to Learn C Introduction #: Same thing as before, just that this time this really cool initializer has been used. #: The parts of the name will be printed out in random order. You'd think that initializers apply values in the order the structure definition defines them, but C language rarely does things sensibly. #: The text will blink. We like blinking html text. #: