main
test-branch
|
Last change
on this file since a389857 was ea777aa, checked in by Alex Wilton <awilton@…>, 3 years ago |
|
Moved examples, include, build_default.properties, common.xml, and README out from dev.civl.com into the root of the repo.
git-svn-id: svn://vsl.cis.udel.edu/civl/trunk@5704 fb995dde-84ed-4084-dfe6-e5aef3e2452c
|
-
Property mode
set to
100644
|
|
File size:
574 bytes
|
| Line | |
|---|
| 1 | #include <stdlib.h>
|
|---|
| 2 | #include <civlc.cvh>
|
|---|
| 3 |
|
|---|
| 4 | $scope root = $here;
|
|---|
| 5 |
|
|---|
| 6 | int main(){
|
|---|
| 7 | double (*p)[2];
|
|---|
| 8 | double * q;
|
|---|
| 9 | double a[3][2];
|
|---|
| 10 | double b[3][2];
|
|---|
| 11 | double **x;
|
|---|
| 12 |
|
|---|
| 13 | p = a; //p == &a[0]
|
|---|
| 14 | q = &b[0][0];
|
|---|
| 15 | p += 1;
|
|---|
| 16 | q += 6;
|
|---|
| 17 | x = (double **)$malloc(root, sizeof(double *) * 3);
|
|---|
| 18 |
|
|---|
| 19 | for(int i=0; i<3; i++)
|
|---|
| 20 | x[i] = (double *)$malloc(root, sizeof(double) * 2);
|
|---|
| 21 |
|
|---|
| 22 | $assert((p - a) == 1);
|
|---|
| 23 | $assert((q - &b[0][0]) == 6);
|
|---|
| 24 | $assert(&x[0] - &x[2] == -2);
|
|---|
| 25 | $assert(&x[0][1] - x[0] == 1);
|
|---|
| 26 | $assert(&x[3] - x == 3);
|
|---|
| 27 | for(int i=0; i<3; i++)
|
|---|
| 28 | $free(x[i]);
|
|---|
| 29 |
|
|---|
| 30 | $free(x);
|
|---|
| 31 | return 0;
|
|---|
| 32 | }
|
|---|
| 33 |
|
|---|
| 34 |
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.