Skip to main content

  | मौसम…

411 समाचार
Public archive edition · Attributed source reporting with original dates · AI drafts are excluded

411 REFERENCE · Wikibooks

C++ Language/Indirection

Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.

Instead of directly referring to a piece of computer memory by the name of some variable, C++ software sometimes refers to it in a more indirect way. A "pointer" is a variable whose value is a memory address. If iVar has already been defined as a int variable, defining int* piVar = &iVar; will use the "address-of" operator (&) to obtain the address where iVar has been stored in memory — that memory address will get stored in pointer variable piVar. On the other hand, a "reference" (int& riVar = iVar;) doesn't create any additional storage; instead, it specifies a new name (riVar) which now also refers to that same storage location that already existed for iVar. Pointers Typed NULL Arrays Reference Variables Rvalue-References Smart Pointers