Added new char array test

git-svn-id: http://picoc.googlecode.com/svn/trunk@266 21eae674-98b7-11dd-bd71-f92a316d2d60
This commit is contained in:
zik.saleeba 2009-04-23 12:08:27 +00:00
parent d06f2442fb
commit 755cbd30b5

24
tests/21_char_array.c Normal file
View file

@ -0,0 +1,24 @@
char *a = "hello";
printf("%s\n", a);
int c;
c = *a;
char *b;
for (b = a; *b != 0; b++)
printf("%c: %d\n", *b, *b);
char destarray[10];
char *dest;
char *src;
dest = &destarray[0];
src = a;
while (*src != 0)
*dest++ = *src++;
*dest = 0;
printf("copied string is %s\n", destarray);