more int/char playing around, casting name as int

This commit is contained in:
Dan Buch 2011-09-08 22:52:39 -04:00
parent 3be4117ef1
commit da1b3f8508

20
ex9.c
View File

@ -15,21 +15,23 @@ int main(int argc, char *argv[])
printf("name: %s\n", name);
numbers[0] = 'Z';
numbers[1] = 'e';
numbers[2] = 'd';
numbers[3] = '\0';
printf("%c\n", numbers[0]);
printf("%c\n", numbers[1]);
printf("%c\n", numbers[2]);
printf("%c\n", numbers[3]);
numbers[0] = 1;
numbers[1] = 2;
numbers[2] = 3;
numbers[3] = 4;
name[0] = 'Z';
name[1] = 'e';
name[2] = 'd';
name[3] = '\0';
printf("%d\n", name[0]);
printf("%d\n", name[1]);
printf("%d\n", name[2]);
printf("%d\n", name[3]);
printf("name as int=%d\n", (int)name);
printf("numbers: %d %d %d %d\n",
numbers[0], numbers[1],
numbers[2], numbers[3]);