This example is intended to be read after the example "PIG".
The source code for dog.c may be downloaded. The purpose of this program is to demonstrate the use of C strings and the ASCII values of characters.
See also:
Prof. Gorry Fairhurst, School of Engineering, University of Aberdeen, Scotland. (2014)you type> cat dog.c
main()
{
/* create an array of characters */
char str1[10]; /* up to 9 chars */
str1[0]='p';
str1[1]='i';
str1[2]='g';
str1[3]=0;
str1[0]=68;
str1[1]=96+15;
printf("The animal is a %s\n",str1);
}
you type> cc -o dog dog.c
you type> dog
The animal is a Dog