home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Programming / C / SASC6571.LZX / examples / data.c < prev    next >
Encoding:
C/C++ Source or Header  |  1996-12-24  |  1.7 KB  |  118 lines

  1. /* Copyright (c) 1993 SAS Institute, Inc, Cary, NC USA */
  2. /* All Rights Reserved */
  3.  
  4. /*  The following example has no practical use.  It is intended 
  5.     only to use to explore the data manipulation functions of 
  6.     CodeProbe.
  7. */    
  8.  
  9. #include <stdio.h>
  10.  
  11. void main (void)
  12. {
  13.    struct X {
  14.       int a;
  15.       int b[3];
  16.       int c;
  17.       } x;
  18.    
  19.    struct Y {
  20.       int a;
  21.       int b;
  22.       } y;
  23.  
  24.    typedef struct X *XPTR;
  25.          
  26.    struct W {
  27.       int x;
  28.       struct Y y[2];
  29.       int z;
  30.       } w;
  31.       
  32.    struct Z {
  33.       char c;
  34.       struct Y d;
  35.       int e;
  36.       } z;
  37.       
  38.    struct X3D {
  39.       int a;
  40.       int b[2][3][2];
  41.       int c;
  42.       } x3d;
  43.       
  44.    int i,j;
  45.    int array[10];              
  46.    int *intptr;
  47.    
  48.    long lng;
  49.    short shrt;
  50.    
  51.    float fl;
  52.    double db;
  53.  
  54.    char *string = "Hello, World";
  55.  
  56.    /*  Initialize data structures.   */
  57.    i = 33;
  58.    j = 44;
  59.    intptr = &i;
  60.    
  61.    lng = 6456;
  62.    shrt = 89;
  63.    
  64.    fl = 3.14;
  65.    db = 33.5;
  66.    
  67.    array[0] = 5;
  68.    array[1] = 15;
  69.    array[2] = 25;
  70.    array[3] = 35;
  71.    array[4] = 45;
  72.    array[5] = 55;
  73.    array[6] = 65;
  74.    array[7] = 75;
  75.    array[8] = 85;
  76.    array[9] = 95;
  77.    
  78.    x.a= 5;
  79.    x.b[0]=1;
  80.    x.b[1]=2;
  81.    x.b[2]=3;
  82.    x.c=11;
  83.    
  84.    y.a=5;
  85.    y.b=6;
  86.       
  87.    w.x=4;
  88.    w.y[0] = y;
  89.    w.y[1] = y;
  90.    w.z = 9;
  91.    
  92.    z.c = 'r';
  93.    z.d = y;
  94.    z.e=3;
  95.  
  96.    intptr = &j;
  97.       
  98.    x3d.a=2;
  99.    x3d.b[0][0][0] = 41 ;
  100.    x3d.b[0][0][1] = 42 ;
  101.    x3d.b[0][1][0] = 43 ;
  102.    x3d.b[0][1][1] = 44 ;
  103.    x3d.b[0][2][0] = 45 ;
  104.    x3d.b[0][2][1] = 46 ;
  105.    x3d.b[1][0][0] = 47 ;
  106.    x3d.b[1][0][1] = 48 ;
  107.    x3d.b[1][1][0] = 49 ;
  108.    x3d.b[1][1][1] = 50;
  109.    x3d.b[1][2][0] = 51;
  110.    x3d.b[1][2][1] = 52;
  111.    x3d.c=90;
  112.    
  113.    printf("%s!\n",string);
  114. }
  115.    
  116.    
  117.    
  118.