twitter
    Find out what I'm doing, Follow Me :)

Outputting Part Of A String

The next "printf" illustrates that we can output any single character of the string by using the "%c" and naming the particular character of "name" we want by including the subscript. The last "printf" illustrates how we can output part of the string by stating the starting point by using a subscript. The & specifies the address of "name[1]". We will study this in the next chapter but I thought you would benefit from a little glimpse ahead.

This example may make you feel that strings are rather cumbersome to use since you have to set up each character one at a time. That is an incorrect conclusion because strings are very easy to use as we will see in the next example program.

Compile and run this program.