// first_struct_try.c - demonstration how to define structs
//                      and how to access the members

#include <stdio.h>
#include <stdlib.h>

// a typical address
struct Address
{
  char *country;   // the country, e.g. Austria
  char *state;     // the state in the country if applicable
                   // e.g. Minnesota for addresses in the USA
                   // NULL if not applicable
  char *zip_code;  // the zip code, e.g. A-8010
  char *city;      // the city, e.g. Graz
  char *street;    // the streetname
  char *number;    // the number of the building in the 
                   // street. This is a string, because there
                   // can also be numbers containing letters!
};


//------------------------------------------------------------
int main()
{
  struct Address test_address;

  test_address.country = "Austria";
  test_address.state = NULL;
  test_address.zip_code = "A-8010";
  test_address.city = "Graz";
  test_address.street = "Inffeldgasse";
  test_address.number = "16c";

  printf("Address:   %s %s\n           %s %s\n",
         test_address.street,
         test_address.number,
         test_address.zip_code,
         test_address.city);

  if (test_address.state)
    printf("           %s, %s\n",test_address.state,
                                 test_address.country);
  else
    printf("           %s\n",test_address.country);
  return(0);
}

