source: CIVL/examples/languageFeatures/int2char.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: 504 bytes
Line 
1#include <civlc.cvh>
2#include <stdio.h>
3
4$input int num;
5$assume(num > 0 && num < 255);
6
7$scope root = $here;
8
9void main(){
10 char c[3];
11 char * pc;
12 int b = 98; // 'b'
13
14 pc = (char*)$malloc(root, sizeof(char) * 3);
15 c[0] = num;
16 c[1] = 'a';
17 c[2] = b - 1;
18
19 pc[0] = num;
20 pc[1] = b - 1;
21 pc[2] = 97;
22 //test symbolic int to char
23 $assert(c[0] == pc[0]);
24 //test if (char)(b-1) == 'a'
25 $assert(c[1] == pc[1]);
26 //test if (char)(98 - 1) == (char)97
27 $assert(c[2] == pc[2]);
28 $free(pc);
29}
Note: See TracBrowser for help on using the repository browser.