Solution for Exercise 19-19
ex1919
#include <stdio.h> int main() { char *fruit[] = { "watermelon", "banana", "pear", "apple", "coconut", "grape", "blueberry" }; int x; for(x=0;x<7;x++) { putchar(**(fruit+x)); putchar('\n'); } return(0); }
Notes
* Here is the output:
The first letter of each string is displayed. That's because **(fruit+x)
represents a character, not a string. If you keep in mind that *(fruit+x)
is really the memory location of the string, then the initial *
is reading the contents of that location.
Copyright © 1997-2024 by QPBC.
All rights reserved