source:
CIVL/mods/dev.civl.com/examples/languageFeatures/sizeof.cvl@
cb4d4f4
| Last change on this file since cb4d4f4 was aad342c, checked in by , 3 years ago | |
|---|---|
|
|
| File size: 303 bytes | |
| Line | |
|---|---|
| 1 | /* Commandline execution: |
| 2 | * civl verify sizeof.cvl |
| 3 | * */ |
| 4 | #include <civlc.cvh> |
| 5 | |
| 6 | void main() { |
| 7 | int n = 5; |
| 8 | int a[n]; |
| 9 | double b[2*n]; |
| 10 | |
| 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); |
| 15 | } |
Note:
See TracBrowser
for help on using the repository browser.
