/* --------------------------------------------------------------------- ** Figure 13.16: Searching for a character or a substring. ** Figure 13.17: Copy and concatenate. ** --------------------------------------------------------------------- */ #include "tools.h" /* contains definition of type string */ #define N 5 void main( void ) { char line[] = "I found the cat in the fort."; char * left, * right, * sub; left = strchr( line, 'n' ); puts( left ); right = strrchr( line, 'f' ); puts( right ); sub = strstr( line, "the" ); puts( sub ); strncpy( line, "Hotdog", 3 ); strcpy( &line[3], " diggety" ); strcat( line, " dog!" ); puts( line ); }