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

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