source:
CIVL/examples/languageFeatures/sizeof.cvl@
d48b845
| Last change on this file since d48b845 was e6b02c8, checked in by , 12 years ago | |
|---|---|
|
|
| File size: 303 bytes | |
| Rev | Line | |
|---|---|---|
| [36b5ada] | 1 | /* Commandline execution: |
| 2 | * civl verify sizeof.cvl | |
| 3 | * */ | |
| [e6b02c8] | 4 | #include <civlc.cvh> |
| [95a2a9e] | 5 | |
| 6 | void main() { | |
| 7 | int n = 5; | |
| 8 | int a[n]; | |
| 9 | double b[2*n]; | |
| 10 | ||
| [09b9231b] | 11 | $assert(sizeof(int) > 0); |
| 12 | $assert(sizeof(a) == sizeof(int) * n); | |
| 13 | $assert(sizeof(int[n]) == sizeof(int) * n); | |
| 14 | $assert(sizeof(b) / sizeof(double) == 2*n); | |
| [95a2a9e] | 15 | } |
Note:
See TracBrowser
for help on using the repository browser.
