Composition
Further information: Pointer: Multiple indirectionThe unary * operator, as defined in C and C++, can be used in compositions in cases of multiple indirection, where multiple acts of dereferencing are required. Pointers can of course reference other pointers, and in such cases, multiple applications of the dereference operator are needed. Similarly, the Java dot operator can be used in compositions forming quite sophisticated statements that require substantial dereferencing of pointers behind the scenes during evaluation.
A basic example is in the argv argument to the main function in C (and C++), which is given in the prototype as char **argv
– this is because the variable argv
itself is a pointer to an array of strings (an array of arrays), so *argv
is a pointer to the 0th string (by convention the name of the program), and **argv
is the 0th character of the 0th string.
Read more about this topic: Dereference Operator
Famous quotes containing the word composition:
“There is singularly nothing that makes a difference a difference in beginning and in the middle and in ending except that each generation has something different at which they are all looking. By this I mean so simply that anybody knows it that composition is the difference which makes each and all of them then different from other generations and this is what makes everything different otherwise they are all alike and everybody knows it because everybody says it.”
—Gertrude Stein (18741946)
“Give a scientist a problem and he will probably provide a solution; historians and sociologists, by contrast, can offer only opinions. Ask a dozen chemists the composition of an organic compound such as methane, and within a short time all twelve will have come up with the same solution of CH4. Ask, however, a dozen economists or sociologists to provide policies to reduce unemployment or the level of crime and twelve widely differing opinions are likely to be offered.”
—Derek Gjertsen, British scientist, author. Science and Philosophy: Past and Present, ch. 3, Penguin (1989)
“Every thing in his composition was little; and he had all the weaknesses of a little mind, without any of the virtues, or even the vices, of a great one.”
—Philip Dormer Stanhope, 4th Earl Chesterfield (16941773)