source: CIVL/examples/languageFeatures/initialCompoundValues.cvl

main
Last change on this file 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: 545 bytes
RevLine 
[7569720]1#include<assert.h>
2
3$input int N;
4$assume(N > 3);
5struct T {
6 int x[10];
7 char y[10];
8};
9
10int main() {
11 int a[10] = {[2] = 2, [8] = 8};
12 int b[10] = {1,2,3};
13 int c[N] = {1, 2, 3};
14 struct T t[10] = {{.x = {1, 2}, .y = {'h'}}};
15
16 assert(a[2] == 2 && a[8] == 8 && a[0] == a[1] && a[0] == a[9] && a[0] == 0);
17 assert(b[0] == 1 && b[1] == 2 && b[2] == 3 && b[3] == 0);
18 assert(c[0] == 1 && c[1] == 2 && c[2] == 3 && c[3] == 0);
19 assert(t[0].x[0] == 1 && t[0].x[1] == 2 && t[0].y[0] == 'h' &&
20 t[1].x[1] == 0 && t[1].y[0] == 0);
21}
Note: See TracBrowser for help on using the repository browser.