<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="http://fileformats.archiveteam.org/skins/common/feed.css?303"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://fileformats.archiveteam.org/index.php?action=history&amp;feed=atom&amp;title=C%2B%2B_pointer</id>
		<title>C++ pointer - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://fileformats.archiveteam.org/index.php?action=history&amp;feed=atom&amp;title=C%2B%2B_pointer"/>
		<link rel="alternate" type="text/html" href="http://fileformats.archiveteam.org/index.php?title=C%2B%2B_pointer&amp;action=history"/>
		<updated>2026-04-21T04:53:57Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.19.2</generator>

	<entry>
		<id>http://fileformats.archiveteam.org/index.php?title=C%2B%2B_pointer&amp;diff=22493&amp;oldid=prev</id>
		<title>VolodyA! V Anarhist: link</title>
		<link rel="alternate" type="text/html" href="http://fileformats.archiveteam.org/index.php?title=C%2B%2B_pointer&amp;diff=22493&amp;oldid=prev"/>
				<updated>2015-05-13T14:49:54Z</updated>
		
		<summary type="html">&lt;p&gt;link&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
			&lt;tr valign='top'&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 14:49, 13 May 2015&lt;/td&gt;
			&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 54:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 54:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;==Pointer to an array==&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;==Pointer to an array==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;A pointer to an array is indistinguishable to a pointer to the first element of that array. Arithmetic can be used to move between elements of the array, square brackets work as well.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;A pointer to an &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;[[C++ &lt;/ins&gt;array&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;|array]] &lt;/ins&gt;is indistinguishable to a pointer to the first element of that array. Arithmetic can be used to move between elements of the array, square brackets work as well.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;pre&amp;gt;int *a, *b;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160;  // 2 pointers&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;pre&amp;gt;int *a, *b;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160;  // 2 pointers&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>VolodyA! V Anarhist</name></author>	</entry>

	<entry>
		<id>http://fileformats.archiveteam.org/index.php?title=C%2B%2B_pointer&amp;diff=22484&amp;oldid=prev</id>
		<title>VolodyA! V Anarhist: Created page with &quot;{{FormatInfo | name           = C++ pointer | formattype     = electronic | subcat         = Data types | subcat2        = C++ data types | subcat3        =  | subcat4        ...&quot;</title>
		<link rel="alternate" type="text/html" href="http://fileformats.archiveteam.org/index.php?title=C%2B%2B_pointer&amp;diff=22484&amp;oldid=prev"/>
				<updated>2015-05-13T09:16:10Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;quot;{{FormatInfo | name           = C++ pointer | formattype     = electronic | subcat         = Data types | subcat2        = C++ data types | subcat3        =  | subcat4        ...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{FormatInfo&lt;br /&gt;
| name           = C++ pointer&lt;br /&gt;
| formattype     = electronic&lt;br /&gt;
| subcat         = Data types&lt;br /&gt;
| subcat2        = C++ data types&lt;br /&gt;
| subcat3        = &lt;br /&gt;
| subcat4        = &lt;br /&gt;
| subcat5        = &lt;br /&gt;
| thiscat        = &lt;br /&gt;
| extensions     = &lt;br /&gt;
| mimetypes      = &lt;br /&gt;
| locfdd         = &lt;br /&gt;
| fourccs        =&lt;br /&gt;
| pronom         =&lt;br /&gt;
| type code      =&lt;br /&gt;
| uniform type   =&lt;br /&gt;
| conforms to    = &lt;br /&gt;
| released       = 1983&lt;br /&gt;
| image          = &lt;br /&gt;
| caption        = &lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
In C++ pointer can store a memory address, normally it is a memory address of another variable or a result of &amp;lt;code&amp;gt;new&amp;lt;/code&amp;gt; operator. The size of a pointer depends upon the computer architecture.&lt;br /&gt;
&lt;br /&gt;
Pointer does not have its own type name, but rather it uses the name of data that it points to with the symbol * before the name of the variable that stores the pointer. For example &amp;lt;code&amp;gt;int a;&amp;lt;/code&amp;gt; is an [[signed int|int]], &amp;lt;code&amp;gt; int *a;&amp;lt;/code&amp;gt; is a pointer to int, &amp;lt;code&amp;gt;int **a;&amp;lt;/code&amp;gt; is a pointer to a pointer to int. It is possible to put a space between * and name as &amp;lt;code&amp;gt;int * a;&amp;lt;/code&amp;gt;, and to remove a space between type of data the pointer will point to and * as &amp;lt;code&amp;gt;int* a;&amp;lt;/code&amp;gt;; unfortunately this causes confusion when people think that it means that &amp;lt;code&amp;gt;int*&amp;lt;/code&amp;gt; defines a pointer to int, however, &amp;lt;code&amp;gt;int* a, b;&amp;lt;/code&amp;gt; will cause a to be a pointer to an integer, and b will be an integer variable.&lt;br /&gt;
&lt;br /&gt;
==Getting address==&lt;br /&gt;
To get an address to store into a pointer one needs to prepend the name of the variable with &amp;amp;. The operator &amp;lt;code&amp;gt;new&amp;lt;/code&amp;gt;, that creates new storage at the run time, also returns the pointer to the created space.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;int *a;&lt;br /&gt;
int b;&lt;br /&gt;
&lt;br /&gt;
a = &amp;amp;b;&lt;br /&gt;
a = new int;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Constant and pointer==&lt;br /&gt;
The confusing case when declaring pointers is differentiating between a constant pointer to data and a pointer to constant data.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;const int * a;              // pointer to const int&lt;br /&gt;
int const * a;              // pointer to const int&lt;br /&gt;
int * const a;              // const pointer to int&lt;br /&gt;
const int * const a;        // const pointer to const int&lt;br /&gt;
int const * const a;        // const pointer to const int&lt;br /&gt;
const int const * a;        // ERROR&lt;br /&gt;
const int const * const a;  // ERROR&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Null pointer==&lt;br /&gt;
Null pointer is a pointer to any data type which points to the non-existing value. Originally this value was written as &amp;lt;code&amp;gt;null&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;0&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;'\0'&amp;lt;/code&amp;gt;, however, from C++11 it should be written as nullptr. It is equivalent of &amp;lt;code&amp;gt;(void*)0&amp;lt;/code&amp;gt; after going through &amp;lt;code&amp;gt;reinterpret_cast&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Void pointer==&lt;br /&gt;
Void pointer is the pointer to some address in memory, without explicit statement of what the data it is pointing to. Because of this it becomes impossible to work with that data (since compiler cannot know the size of the data, and won't even know how many bytes to get at that address). Void pointer is declared as &amp;lt;code&amp;gt;void *&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
They are very rarely used in high-level C++ applications, but when they are used casting them to a pointer of a different type is needed before they can be dereferenced and used.&lt;br /&gt;
&lt;br /&gt;
==Pointer to an array==&lt;br /&gt;
A pointer to an array is indistinguishable to a pointer to the first element of that array. Arithmetic can be used to move between elements of the array, square brackets work as well.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;int *a, *b;                   // 2 pointers&lt;br /&gt;
int ar_a[5]{0}, ar_b[5]{0};   // 2 arrays&lt;br /&gt;
&lt;br /&gt;
a = ar_a;&lt;br /&gt;
b = &amp;amp;(ar_b[0]);&lt;br /&gt;
&lt;br /&gt;
a++;&lt;br /&gt;
b+=1;&lt;br /&gt;
&lt;br /&gt;
(*a) = 3;&lt;br /&gt;
b[0] = 3;&lt;br /&gt;
&lt;br /&gt;
a[2] = 5;&lt;br /&gt;
*(b+2) = 5;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here the exact same thing was happening to both arrays.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* [[std::ptr]]&lt;br /&gt;
* [[std::nullptr_t]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Enumerable data types]]&lt;/div&gt;</summary>
		<author><name>VolodyA! V Anarhist</name></author>	</entry>

	</feed>