翻訳と辞書
Words near each other
・ "O" Is for Outlaw
・ "O"-Jung.Ban.Hap.
・ "Ode-to-Napoleon" hexachord
・ "Oh Yeah!" Live
・ "Our Contemporary" regional art exhibition (Leningrad, 1975)
・ "P" Is for Peril
・ "Pimpernel" Smith
・ "Polish death camp" controversy
・ "Pro knigi" ("About books")
・ "Prosopa" Greek Television Awards
・ "Pussy Cats" Starring the Walkmen
・ "Q" Is for Quarry
・ "R" Is for Ricochet
・ "R" The King (2016 film)
・ "Rags" Ragland
・ ! (album)
・ ! (disambiguation)
・ !!
・ !!!
・ !!! (album)
・ !!Destroy-Oh-Boy!!
・ !Action Pact!
・ !Arriba! La Pachanga
・ !Hero
・ !Hero (album)
・ !Kung language
・ !Oka Tokat
・ !PAUS3
・ !T.O.O.H.!
・ !Women Art Revolution


Dictionary Lists
翻訳と辞書 辞書検索 [ 開発暫定版 ]
スポンサード リンク

Dereference : ウィキペディア英語版
Dereference operator

The dereference operator or indirection operator, denoted by "
*
" (i.e. an asterisk), is a unary operator found in C-like languages that include pointer variables. It operates on a pointer variable, and returns an l-value equivalent to the value at the pointer address. This is called "dereferencing" the pointer. For example, the C code

int x;
int
*p; //
* is used in the declaration:
// p is a pointer to an integer, since (after dereferencing),
//
*p is an integer
x = 0;
// now x == 0
p = &x; // & takes the address of x
// now p == &x, so
*p == x

*p = 1; // equivalent to x = 1, since
*p == x
// now
*p == 1 and
*p == x, so x == 1

assigned 1 to variable x by using the dereference operator and a pointer to the variable x.
== Composition ==

The 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 of multiple pointer indirection is the argv argument to the main function in C (and C++), which is given in the prototype as char
*
*argv
. The name of the invoked program executable, as well as all command line arguments that followed, are stored as independent character strings. An array of pointers to char contains pointers to the first character of each of these strings, and this array of pointers is passed to the main function as the argv argument. The passed array itself "decays" to a pointer, thus argv is actually a pointer to a pointer to char, even though it stands for an array of pointers to char (similarly, the pointers in the array, while each formally pointing to a single char, actually point to what are strings of characters). The accompanying main argument, argc, provides the size of the array (i.e. the number of strings pointed to by the elements of the array), as the size of an (outmost) array is otherwise lost when it is passed to a function and converted to a pointer. Thus, argv is a pointer to the 0th element of an array of pointers to char,
*argv
, which in turn is a pointer to
*
*argv
, a character (precisely, the 0th character of the first argument string, which by convention is the name of the program).

抄文引用元・出典: フリー百科事典『 ウィキペディア(Wikipedia)
ウィキペディアで「Dereference operator」の詳細全文を読む



スポンサード リンク
翻訳と辞書 : 翻訳のためのインターネットリソース

Copyright(C) kotoba.ne.jp 1997-2016. All Rights Reserved.