/* BAD Example:  */

#include <stdio.h>
typedef struct person 
{ 
    char *name; 
    char *addr; 
    int age; 
} person;

person changeit (person); 
int main (void) 
{ 
  struct person wu; 
  static struct person student = {"liu", "Tainan", 20}; 
  printf ("Before calling...\n"); 
  printf ("Ms. %s lived at %s when she was %d years old.\n" 
               , student.name, student.addr, student.age); 
  wu = changeit(student); 
  printf ("After calling...\n"); 
  printf ("Ms. %s lived at %s when she was %d years old.\n" 
              , wu.name, wu.addr, wu.age); 
  return(0);
} 

person changeit (p) 
person p;    /*pass structure*/ 
{ 
            p.addr = "Taipei"; 
            p.age = 100; 
            return (p);    /* return a structure */ 
} 
  

// This example is very simple and easy to construct, however,
// it wastes space converting the data.  If the program
// were really large, the access time will far greater.
