view test/c3examples/types.c3 @ 284:05184b95fa16

Moved tests to seperate folder
author Windel Bouwman
date Fri, 15 Nov 2013 13:43:22 +0100
parents python/c3/examples/types.c3@81752b0f85a5
children d9df72971cbf
line wrap: on
line source


/*
 Demo of how to define types
*/

package typedemo;

type int A;
type int B;
type struct {
  int x, y;
  A z;
} C;
type struct {
  C x;
  B y;
  int z;
} D;

type D* E;

function int testcast()
{
    var A a;
    var B b;
    a = 3;
    b = a;
    var C c;
    c.x = a;
    c.z = c.y;
    var D d;
    var E e;
    var D* e2;
    e = &d;
    e2 = e;
    e2->x.x = 22;
    
    return 0;
}