nomalloc.c
changeset 0 af501b0c1716
child 8 96d16dfe787a
equal deleted inserted replaced
-1:000000000000 0:af501b0c1716
       
     1 /**
       
     2  *     $Id: nomalloc.c,v 1.1.1.1 2008-04-28 17:32:53 mbroeker Exp $
       
     3  * $Source: /development/c/demos/nomalloc.c,v $
       
     4  *
       
     5  */
       
     6 
       
     7 #include <stdio.h>
       
     8 
       
     9 struct Names {
       
    10     char *name;
       
    11     int age;
       
    12 };
       
    13 
       
    14 void setStruct (struct Names *names)
       
    15 {
       
    16     names->name = "mbroeker";
       
    17     names->age = 32;
       
    18 }
       
    19 
       
    20 void printStruct (struct Names *names)
       
    21 {
       
    22     printf ("Name: %s\n", names->name);
       
    23     printf (" Age: %d\n", (*names).age);
       
    24 }
       
    25 
       
    26 int main (int argc, char **argv)
       
    27 {
       
    28     struct Names names;
       
    29 
       
    30     setStruct (&names);
       
    31     printStruct (&names);
       
    32 
       
    33     return 0;
       
    34 }