Changes in src/tests/references.c [b05a4eb:a8555c5]
- File:
-
- 1 edited
-
src/tests/references.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/tests/references.c
rb05a4eb ra8555c5 37 37 int * toptr( int & r ) { return &r; } 38 38 39 void changeRef( int & r ) {40 r++;41 }42 43 39 int main() { 44 40 int x = 123456, *p1 = &x, **p2 = &p1, ***p3 = &p2, … … 47 43 **p3 = &x; // change p1 48 44 *p3 = &p1; // change p2 49 int y = 0, z = 11, & ar[3] = { x, y, z }; // initialize array of references45 int y, z, & ar[3] = { x, y, z }; // initialize array of references 50 46 51 47 // test that basic reference properties are true - r1 should be an alias for x … … 56 52 // test that functions using basic references work 57 53 printf("%d %d %d %d\n", toref(&x), toref(p1), toptr(r1) == toptr(x), toptr(r1) == &x); 58 59 changeRef( x );60 changeRef( y );61 changeRef( z );62 printf("%d %d %d\n", x, y, z);63 changeRef( r1 );64 printf("%d %d\n", r1, x);65 54 66 55 // test that reference members are not implicitly constructed/destructed/assigned
Note:
See TracChangeset
for help on using the changeset viewer.