Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Pointer (computer programming)
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Formal description== In [[computer science]], a pointer is a kind of [[Reference (computer science)|reference]]. A ''data primitive'' (or just ''primitive'') is any datum that can be read from or written to [[computer memory]] using one memory access (for instance, both a ''[[byte]]'' and a ''[[Word (computer architecture)|word]]'' are primitives). A ''data aggregate'' (or just ''aggregate'') is a group of primitives that are [[Logical address|logically]] contiguous in memory and that are viewed collectively as one datum (for instance, an aggregate could be 3 logically contiguous bytes, the values of which represent the 3 coordinates of a point in space). When an aggregate is entirely composed of the same type of primitive, the aggregate may be called an [[Array data structure|''array'']]; in a sense, a multi-byte ''word'' primitive is an array of bytes, and some programs use words in this way. In the context of these definitions, a ''byte'' is the smallest primitive; each [[memory address]] specifies a different byte. The memory address of the initial byte of a datum is considered the memory address (or ''base memory address'') of the entire datum. A ''memory pointer'' (or just ''pointer'') is a primitive, the value of which is intended to be used as a memory address; it is said that ''a pointer points to a memory address''. It is also said that ''a pointer points to a datum [in memory]'' when the pointer's value is the datum's memory address. More generally, a pointer is a kind of [[Reference (computer science)|reference]], and it is said that ''a pointer references a datum stored somewhere in memory''; to obtain that datum is ''to dereference the pointer''. The feature that separates pointers from other kinds of reference is that a pointer's value is meant to be interpreted as a memory address, which is a rather low-level concept. References serve as a level of indirection: A pointer's value determines which memory address (that is, which datum) is to be used in a calculation. Because indirection is a fundamental aspect of algorithms, pointers are often expressed as a fundamental [[data type]] in [[programming language]]s; in [[Static types|statically]] (or [[Strong and weak typing|strongly]]) typed programming languages, the [[Type system|type]] of a pointer determines the type of the datum to which the pointer points.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)