source: CIVL/examples/library/string/string_test.cvl@ a389857

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: 336 bytes
Line 
1#include <civlc.cvh>
2#include<stdlib.h>
3#include<string.h>
4
5void main(){
6 char* s;
7 int len;
8
9 s = (char*)malloc(sizeof(char) * 5);
10
11 //s[0] = 'a';
12 //s[1] = 'b';
13 strcpy(s, "abcd");
14 int x = strcmp(s, "abcd");
15 $assert(x==0);
16 len = strlen(s);
17 $assert(len == 4);
18 len = strlen(s + 1);
19 $assert(len == 3);
20 free(s);
21}
Note: See TracBrowser for help on using the repository browser.