CINXE.COM

Pointer (computer programming) - Wikipedia

<!DOCTYPE html> <html class="client-nojs vector-feature-language-in-header-enabled vector-feature-language-in-main-page-header-disabled vector-feature-page-tools-pinned-disabled vector-feature-toc-pinned-clientpref-1 vector-feature-main-menu-pinned-disabled vector-feature-limited-width-clientpref-1 vector-feature-limited-width-content-enabled vector-feature-custom-font-size-clientpref-1 vector-feature-appearance-pinned-clientpref-1 vector-feature-night-mode-enabled skin-theme-clientpref-day vector-sticky-header-enabled vector-toc-available" lang="en" dir="ltr"> <head> <meta charset="UTF-8"> <title>Pointer (computer programming) - Wikipedia</title> <script>(function(){var className="client-js vector-feature-language-in-header-enabled vector-feature-language-in-main-page-header-disabled vector-feature-page-tools-pinned-disabled vector-feature-toc-pinned-clientpref-1 vector-feature-main-menu-pinned-disabled vector-feature-limited-width-clientpref-1 vector-feature-limited-width-content-enabled vector-feature-custom-font-size-clientpref-1 vector-feature-appearance-pinned-clientpref-1 vector-feature-night-mode-enabled skin-theme-clientpref-day vector-sticky-header-enabled vector-toc-available";var cookie=document.cookie.match(/(?:^|; )enwikimwclientpreferences=([^;]+)/);if(cookie){cookie[1].split('%2C').forEach(function(pref){className=className.replace(new RegExp('(^| )'+pref.replace(/-clientpref-\w+$|[^\w-]+/g,'')+'-clientpref-\\w+( |$)'),'$1'+pref+'$2');});}document.documentElement.className=className;}());RLCONF={"wgBreakFrames":false,"wgSeparatorTransformTable":["",""],"wgDigitTransformTable":["",""],"wgDefaultDateFormat":"dmy","wgMonthNames":["","January","February","March","April","May","June","July","August","September","October","November","December"],"wgRequestId":"c0227828-abe7-4ff8-b5f4-c29476073726","wgCanonicalNamespace":"","wgCanonicalSpecialPageName":false,"wgNamespaceNumber":0,"wgPageName":"Pointer_(computer_programming)","wgTitle":"Pointer (computer programming)","wgCurRevisionId":1281405968,"wgRevisionId":1281405968,"wgArticleId":459018,"wgIsArticle":true,"wgIsRedirect":false,"wgAction":"view","wgUserName":null,"wgUserGroups":["*"],"wgCategories":["Webarchive template wayback links","Articles with short description","Short description is different from Wikidata","Articles needing additional references from April 2018","All articles needing additional references","All articles with unsourced statements","Articles with unsourced statements from May 2009","Articles with unsourced statements from July 2011","Articles with unsourced statements from September 2011","Articles with unsourced statements from February 2014","Commons category link is on Wikidata","CS1 maint: multiple names: authors list","CS1 maint: numeric names: authors list","Articles with example C code","Articles with example Ada code","Articles with example BASIC code","Articles with example C++ code","Articles with example C Sharp code","Articles with example D code","Articles with example Eiffel code","Articles with example Fortran code","Articles with example Java code","Articles with example Pascal code","Pointers (computer programming)","Primitive types","American inventions","Programming language comparisons"],"wgPageViewLanguage":"en","wgPageContentLanguage":"en","wgPageContentModel":"wikitext","wgRelevantPageName":"Pointer_(computer_programming)","wgRelevantArticleId":459018,"wgIsProbablyEditable":true,"wgRelevantPageIsProbablyEditable":true,"wgRestrictionEdit":[],"wgRestrictionMove":[],"wgRedirectedFrom":"Dereference_operator","wgNoticeProject":"wikipedia","wgCiteReferencePreviewsActive":false,"wgFlaggedRevsParams":{"tags":{"status":{"levels":1}}},"wgMediaViewerOnClick":true,"wgMediaViewerEnabledByDefault":true,"wgPopupsFlags":0,"wgVisualEditor":{"pageLanguageCode":"en","pageLanguageDir":"ltr","pageVariantFallbacks":"en"},"wgMFDisplayWikibaseDescriptions":{"search":true,"watchlist":true,"tagline":false,"nearby":true},"wgWMESchemaEditAttemptStepOversample":false,"wgWMEPageLength":70000,"wgInternalRedirectTargetUrl":"/wiki/Pointer_(computer_programming)","wgEditSubmitButtonLabelPublish":true,"wgULSPosition":"interlanguage","wgULSisCompactLinksEnabled":false,"wgVector2022LanguageInHeader":true,"wgULSisLanguageSelectorEmpty":false,"wgWikibaseItemId":"Q118155","wgCheckUserClientHintsHeadersJsApi":["brands","architecture","bitness","fullVersionList","mobile","model","platform","platformVersion"],"GEHomepageSuggestedEditsEnableTopics":true,"wgGETopicsMatchModeEnabled":false,"wgGELevelingUpEnabledForUser":false}; RLSTATE={"ext.globalCssJs.user.styles":"ready","site.styles":"ready","user.styles":"ready","ext.globalCssJs.user":"ready","user":"ready","user.options":"loading","ext.cite.styles":"ready","ext.pygments":"ready","skins.vector.search.codex.styles":"ready","skins.vector.styles":"ready","skins.vector.icons":"ready","jquery.makeCollapsible.styles":"ready","ext.wikimediamessages.styles":"ready","ext.visualEditor.desktopArticleTarget.noscript":"ready","ext.uls.interlanguage":"ready","wikibase.client.init":"ready"};RLPAGEMODULES=["mediawiki.action.view.redirect","ext.cite.ux-enhancements","ext.pygments.view","mediawiki.page.media","site","mediawiki.page.ready","jquery.makeCollapsible","mediawiki.toc","skins.vector.js","ext.centralNotice.geoIP","ext.centralNotice.startUp","ext.gadget.ReferenceTooltips","ext.gadget.switcher","ext.urlShortener.toolbar","ext.centralauth.centralautologin","mmv.bootstrap","ext.popups","ext.visualEditor.desktopArticleTarget.init","ext.visualEditor.targetLoader","ext.echo.centralauth","ext.eventLogging","ext.wikimediaEvents","ext.navigationTiming","ext.uls.interface","ext.cx.eventlogging.campaigns","ext.cx.uls.quick.actions","wikibase.client.vector-2022","ext.checkUser.clientHints","ext.quicksurveys.init","ext.growthExperiments.SuggestedEditSession"];</script> <script>(RLQ=window.RLQ||[]).push(function(){mw.loader.impl(function(){return["user.options@12s5i",function($,jQuery,require,module){mw.user.tokens.set({"patrolToken":"+\\","watchToken":"+\\","csrfToken":"+\\"}); }];});});</script> <link rel="stylesheet" href="/w/load.php?lang=en&amp;modules=ext.cite.styles%7Cext.pygments%7Cext.uls.interlanguage%7Cext.visualEditor.desktopArticleTarget.noscript%7Cext.wikimediamessages.styles%7Cjquery.makeCollapsible.styles%7Cskins.vector.icons%2Cstyles%7Cskins.vector.search.codex.styles%7Cwikibase.client.init&amp;only=styles&amp;skin=vector-2022"> <script async="" src="/w/load.php?lang=en&amp;modules=startup&amp;only=scripts&amp;raw=1&amp;skin=vector-2022"></script> <meta name="ResourceLoaderDynamicStyles" content=""> <link rel="stylesheet" href="/w/load.php?lang=en&amp;modules=site.styles&amp;only=styles&amp;skin=vector-2022"> <meta name="generator" content="MediaWiki 1.44.0-wmf.22"> <meta name="referrer" content="origin"> <meta name="referrer" content="origin-when-cross-origin"> <meta name="robots" content="max-image-preview:standard"> <meta name="format-detection" content="telephone=no"> <meta property="og:image" content="https://upload.wikimedia.org/wikipedia/commons/thumb/b/b4/Pointers.svg/1200px-Pointers.svg.png"> <meta property="og:image:width" content="1200"> <meta property="og:image:height" content="1332"> <meta property="og:image" content="https://upload.wikimedia.org/wikipedia/commons/thumb/b/b4/Pointers.svg/800px-Pointers.svg.png"> <meta property="og:image:width" content="800"> <meta property="og:image:height" content="888"> <meta property="og:image" content="https://upload.wikimedia.org/wikipedia/commons/thumb/b/b4/Pointers.svg/640px-Pointers.svg.png"> <meta property="og:image:width" content="640"> <meta property="og:image:height" content="710"> <meta name="viewport" content="width=1120"> <meta property="og:title" content="Pointer (computer programming) - Wikipedia"> <meta property="og:type" content="website"> <link rel="preconnect" href="//upload.wikimedia.org"> <link rel="alternate" media="only screen and (max-width: 640px)" href="//en.m.wikipedia.org/wiki/Pointer_(computer_programming)"> <link rel="alternate" type="application/x-wiki" title="Edit this page" href="/w/index.php?title=Pointer_(computer_programming)&amp;action=edit"> <link rel="apple-touch-icon" href="/static/apple-touch/wikipedia.png"> <link rel="icon" href="/static/favicon/wikipedia.ico"> <link rel="search" type="application/opensearchdescription+xml" href="/w/rest.php/v1/search" title="Wikipedia (en)"> <link rel="EditURI" type="application/rsd+xml" href="//en.wikipedia.org/w/api.php?action=rsd"> <link rel="canonical" href="https://en.wikipedia.org/wiki/Pointer_(computer_programming)"> <link rel="license" href="https://creativecommons.org/licenses/by-sa/4.0/deed.en"> <link rel="alternate" type="application/atom+xml" title="Wikipedia Atom feed" href="/w/index.php?title=Special:RecentChanges&amp;feed=atom"> <link rel="dns-prefetch" href="//meta.wikimedia.org" /> <link rel="dns-prefetch" href="login.wikimedia.org"> </head> <body class="skin--responsive skin-vector skin-vector-search-vue mediawiki ltr sitedir-ltr mw-hide-empty-elt ns-0 ns-subject mw-editable page-Pointer_computer_programming rootpage-Pointer_computer_programming skin-vector-2022 action-view"><a class="mw-jump-link" href="#bodyContent">Jump to content</a> <div class="vector-header-container"> <header class="vector-header mw-header"> <div class="vector-header-start"> <nav class="vector-main-menu-landmark" aria-label="Site"> <div id="vector-main-menu-dropdown" class="vector-dropdown vector-main-menu-dropdown vector-button-flush-left vector-button-flush-right" title="Main menu" > <input type="checkbox" id="vector-main-menu-dropdown-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-vector-main-menu-dropdown" class="vector-dropdown-checkbox " aria-label="Main menu" > <label id="vector-main-menu-dropdown-label" for="vector-main-menu-dropdown-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only " aria-hidden="true" ><span class="vector-icon mw-ui-icon-menu mw-ui-icon-wikimedia-menu"></span> <span class="vector-dropdown-label-text">Main menu</span> </label> <div class="vector-dropdown-content"> <div id="vector-main-menu-unpinned-container" class="vector-unpinned-container"> <div id="vector-main-menu" class="vector-main-menu vector-pinnable-element"> <div class="vector-pinnable-header vector-main-menu-pinnable-header vector-pinnable-header-unpinned" data-feature-name="main-menu-pinned" data-pinnable-element-id="vector-main-menu" data-pinned-container-id="vector-main-menu-pinned-container" data-unpinned-container-id="vector-main-menu-unpinned-container" > <div class="vector-pinnable-header-label">Main menu</div> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-pin-button" data-event-name="pinnable-header.vector-main-menu.pin">move to sidebar</button> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-unpin-button" data-event-name="pinnable-header.vector-main-menu.unpin">hide</button> </div> <div id="p-navigation" class="vector-menu mw-portlet mw-portlet-navigation" > <div class="vector-menu-heading"> Navigation </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="n-mainpage-description" class="mw-list-item"><a href="/wiki/Main_Page" title="Visit the main page [z]" accesskey="z"><span>Main page</span></a></li><li id="n-contents" class="mw-list-item"><a href="/wiki/Wikipedia:Contents" title="Guides to browsing Wikipedia"><span>Contents</span></a></li><li id="n-currentevents" class="mw-list-item"><a href="/wiki/Portal:Current_events" title="Articles related to current events"><span>Current events</span></a></li><li id="n-randompage" class="mw-list-item"><a href="/wiki/Special:Random" title="Visit a randomly selected article [x]" accesskey="x"><span>Random article</span></a></li><li id="n-aboutsite" class="mw-list-item"><a href="/wiki/Wikipedia:About" title="Learn about Wikipedia and how it works"><span>About Wikipedia</span></a></li><li id="n-contactpage" class="mw-list-item"><a href="//en.wikipedia.org/wiki/Wikipedia:Contact_us" title="How to contact Wikipedia"><span>Contact us</span></a></li> </ul> </div> </div> <div id="p-interaction" class="vector-menu mw-portlet mw-portlet-interaction" > <div class="vector-menu-heading"> Contribute </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="n-help" class="mw-list-item"><a href="/wiki/Help:Contents" title="Guidance on how to use and edit Wikipedia"><span>Help</span></a></li><li id="n-introduction" class="mw-list-item"><a href="/wiki/Help:Introduction" title="Learn how to edit Wikipedia"><span>Learn to edit</span></a></li><li id="n-portal" class="mw-list-item"><a href="/wiki/Wikipedia:Community_portal" title="The hub for editors"><span>Community portal</span></a></li><li id="n-recentchanges" class="mw-list-item"><a href="/wiki/Special:RecentChanges" title="A list of recent changes to Wikipedia [r]" accesskey="r"><span>Recent changes</span></a></li><li id="n-upload" class="mw-list-item"><a href="/wiki/Wikipedia:File_upload_wizard" title="Add images or other media for use on Wikipedia"><span>Upload file</span></a></li><li id="n-specialpages" class="mw-list-item"><a href="/wiki/Special:SpecialPages"><span>Special pages</span></a></li> </ul> </div> </div> </div> </div> </div> </div> </nav> <a href="/wiki/Main_Page" class="mw-logo"> <img class="mw-logo-icon" src="/static/images/icons/wikipedia.png" alt="" aria-hidden="true" height="50" width="50"> <span class="mw-logo-container skin-invert"> <img class="mw-logo-wordmark" alt="Wikipedia" src="/static/images/mobile/copyright/wikipedia-wordmark-en.svg" style="width: 7.5em; height: 1.125em;"> <img class="mw-logo-tagline" alt="The Free Encyclopedia" src="/static/images/mobile/copyright/wikipedia-tagline-en.svg" width="117" height="13" style="width: 7.3125em; height: 0.8125em;"> </span> </a> </div> <div class="vector-header-end"> <div id="p-search" role="search" class="vector-search-box-vue vector-search-box-collapses vector-search-box-show-thumbnail vector-search-box-auto-expand-width vector-search-box"> <a href="/wiki/Special:Search" class="cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only search-toggle" title="Search Wikipedia [f]" accesskey="f"><span class="vector-icon mw-ui-icon-search mw-ui-icon-wikimedia-search"></span> <span>Search</span> </a> <div class="vector-typeahead-search-container"> <div class="cdx-typeahead-search cdx-typeahead-search--show-thumbnail cdx-typeahead-search--auto-expand-width"> <form action="/w/index.php" id="searchform" class="cdx-search-input cdx-search-input--has-end-button"> <div id="simpleSearch" class="cdx-search-input__input-wrapper" data-search-loc="header-moved"> <div class="cdx-text-input cdx-text-input--has-start-icon"> <input class="cdx-text-input__input" type="search" name="search" placeholder="Search Wikipedia" aria-label="Search Wikipedia" autocapitalize="sentences" title="Search Wikipedia [f]" accesskey="f" id="searchInput" > <span class="cdx-text-input__icon cdx-text-input__start-icon"></span> </div> <input type="hidden" name="title" value="Special:Search"> </div> <button class="cdx-button cdx-search-input__end-button">Search</button> </form> </div> </div> </div> <nav class="vector-user-links vector-user-links-wide" aria-label="Personal tools"> <div class="vector-user-links-main"> <div id="p-vector-user-menu-preferences" class="vector-menu mw-portlet emptyPortlet" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> </ul> </div> </div> <div id="p-vector-user-menu-userpage" class="vector-menu mw-portlet emptyPortlet" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> </ul> </div> </div> <nav class="vector-appearance-landmark" aria-label="Appearance"> <div id="vector-appearance-dropdown" class="vector-dropdown " title="Change the appearance of the page&#039;s font size, width, and color" > <input type="checkbox" id="vector-appearance-dropdown-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-vector-appearance-dropdown" class="vector-dropdown-checkbox " aria-label="Appearance" > <label id="vector-appearance-dropdown-label" for="vector-appearance-dropdown-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only " aria-hidden="true" ><span class="vector-icon mw-ui-icon-appearance mw-ui-icon-wikimedia-appearance"></span> <span class="vector-dropdown-label-text">Appearance</span> </label> <div class="vector-dropdown-content"> <div id="vector-appearance-unpinned-container" class="vector-unpinned-container"> </div> </div> </div> </nav> <div id="p-vector-user-menu-notifications" class="vector-menu mw-portlet emptyPortlet" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> </ul> </div> </div> <div id="p-vector-user-menu-overflow" class="vector-menu mw-portlet" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="pt-sitesupport-2" class="user-links-collapsible-item mw-list-item user-links-collapsible-item"><a data-mw="interface" href="https://donate.wikimedia.org/?wmf_source=donate&amp;wmf_medium=sidebar&amp;wmf_campaign=en.wikipedia.org&amp;uselang=en" class=""><span>Donate</span></a> </li> <li id="pt-createaccount-2" class="user-links-collapsible-item mw-list-item user-links-collapsible-item"><a data-mw="interface" href="/w/index.php?title=Special:CreateAccount&amp;returnto=Pointer+%28computer+programming%29" title="You are encouraged to create an account and log in; however, it is not mandatory" class=""><span>Create account</span></a> </li> <li id="pt-login-2" class="user-links-collapsible-item mw-list-item user-links-collapsible-item"><a data-mw="interface" href="/w/index.php?title=Special:UserLogin&amp;returnto=Pointer+%28computer+programming%29" title="You&#039;re encouraged to log in; however, it&#039;s not mandatory. [o]" accesskey="o" class=""><span>Log in</span></a> </li> </ul> </div> </div> </div> <div id="vector-user-links-dropdown" class="vector-dropdown vector-user-menu vector-button-flush-right vector-user-menu-logged-out" title="Log in and more options" > <input type="checkbox" id="vector-user-links-dropdown-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-vector-user-links-dropdown" class="vector-dropdown-checkbox " aria-label="Personal tools" > <label id="vector-user-links-dropdown-label" for="vector-user-links-dropdown-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only " aria-hidden="true" ><span class="vector-icon mw-ui-icon-ellipsis mw-ui-icon-wikimedia-ellipsis"></span> <span class="vector-dropdown-label-text">Personal tools</span> </label> <div class="vector-dropdown-content"> <div id="p-personal" class="vector-menu mw-portlet mw-portlet-personal user-links-collapsible-item" title="User menu" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="pt-sitesupport" class="user-links-collapsible-item mw-list-item"><a href="https://donate.wikimedia.org/?wmf_source=donate&amp;wmf_medium=sidebar&amp;wmf_campaign=en.wikipedia.org&amp;uselang=en"><span>Donate</span></a></li><li id="pt-createaccount" class="user-links-collapsible-item mw-list-item"><a href="/w/index.php?title=Special:CreateAccount&amp;returnto=Pointer+%28computer+programming%29" title="You are encouraged to create an account and log in; however, it is not mandatory"><span class="vector-icon mw-ui-icon-userAdd mw-ui-icon-wikimedia-userAdd"></span> <span>Create account</span></a></li><li id="pt-login" class="user-links-collapsible-item mw-list-item"><a href="/w/index.php?title=Special:UserLogin&amp;returnto=Pointer+%28computer+programming%29" title="You&#039;re encouraged to log in; however, it&#039;s not mandatory. [o]" accesskey="o"><span class="vector-icon mw-ui-icon-logIn mw-ui-icon-wikimedia-logIn"></span> <span>Log in</span></a></li> </ul> </div> </div> <div id="p-user-menu-anon-editor" class="vector-menu mw-portlet mw-portlet-user-menu-anon-editor" > <div class="vector-menu-heading"> Pages for logged out editors <a href="/wiki/Help:Introduction" aria-label="Learn more about editing"><span>learn more</span></a> </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="pt-anoncontribs" class="mw-list-item"><a href="/wiki/Special:MyContributions" title="A list of edits made from this IP address [y]" accesskey="y"><span>Contributions</span></a></li><li id="pt-anontalk" class="mw-list-item"><a href="/wiki/Special:MyTalk" title="Discussion about edits from this IP address [n]" accesskey="n"><span>Talk</span></a></li> </ul> </div> </div> </div> </div> </nav> </div> </header> </div> <div class="mw-page-container"> <div class="mw-page-container-inner"> <div class="vector-sitenotice-container"> <div id="siteNotice"><!-- CentralNotice --></div> </div> <div class="vector-column-start"> <div class="vector-main-menu-container"> <div id="mw-navigation"> <nav id="mw-panel" class="vector-main-menu-landmark" aria-label="Site"> <div id="vector-main-menu-pinned-container" class="vector-pinned-container"> </div> </nav> </div> </div> <div class="vector-sticky-pinned-container"> <nav id="mw-panel-toc" aria-label="Contents" data-event-name="ui.sidebar-toc" class="mw-table-of-contents-container vector-toc-landmark"> <div id="vector-toc-pinned-container" class="vector-pinned-container"> <div id="vector-toc" class="vector-toc vector-pinnable-element"> <div class="vector-pinnable-header vector-toc-pinnable-header vector-pinnable-header-pinned" data-feature-name="toc-pinned" data-pinnable-element-id="vector-toc" > <h2 class="vector-pinnable-header-label">Contents</h2> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-pin-button" data-event-name="pinnable-header.vector-toc.pin">move to sidebar</button> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-unpin-button" data-event-name="pinnable-header.vector-toc.unpin">hide</button> </div> <ul class="vector-toc-contents" id="mw-panel-toc-list"> <li id="toc-mw-content-text" class="vector-toc-list-item vector-toc-level-1"> <a href="#" class="vector-toc-link"> <div class="vector-toc-text">(Top)</div> </a> </li> <li id="toc-History" class="vector-toc-list-item vector-toc-level-1"> <a class="vector-toc-link" href="#History"> <div class="vector-toc-text"> <span class="vector-toc-numb">1</span> <span>History</span> </div> </a> <ul id="toc-History-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Formal_description" class="vector-toc-list-item vector-toc-level-1"> <a class="vector-toc-link" href="#Formal_description"> <div class="vector-toc-text"> <span class="vector-toc-numb">2</span> <span>Formal description</span> </div> </a> <ul id="toc-Formal_description-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Architectural_roots" class="vector-toc-list-item vector-toc-level-1"> <a class="vector-toc-link" href="#Architectural_roots"> <div class="vector-toc-text"> <span class="vector-toc-numb">3</span> <span>Architectural roots</span> </div> </a> <ul id="toc-Architectural_roots-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Uses" class="vector-toc-list-item vector-toc-level-1"> <a class="vector-toc-link" href="#Uses"> <div class="vector-toc-text"> <span class="vector-toc-numb">4</span> <span>Uses</span> </div> </a> <button aria-controls="toc-Uses-sublist" class="cdx-button cdx-button--weight-quiet cdx-button--icon-only vector-toc-toggle"> <span class="vector-icon mw-ui-icon-wikimedia-expand"></span> <span>Toggle Uses subsection</span> </button> <ul id="toc-Uses-sublist" class="vector-toc-list"> <li id="toc-C_pointers" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#C_pointers"> <div class="vector-toc-text"> <span class="vector-toc-numb">4.1</span> <span>C pointers</span> </div> </a> <ul id="toc-C_pointers-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Use_in_data_structures" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Use_in_data_structures"> <div class="vector-toc-text"> <span class="vector-toc-numb">4.2</span> <span>Use in data structures</span> </div> </a> <ul id="toc-Use_in_data_structures-sublist" class="vector-toc-list"> <li id="toc-C_arrays" class="vector-toc-list-item vector-toc-level-3"> <a class="vector-toc-link" href="#C_arrays"> <div class="vector-toc-text"> <span class="vector-toc-numb">4.2.1</span> <span>C arrays</span> </div> </a> <ul id="toc-C_arrays-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-C_linked_list" class="vector-toc-list-item vector-toc-level-3"> <a class="vector-toc-link" href="#C_linked_list"> <div class="vector-toc-text"> <span class="vector-toc-numb">4.2.2</span> <span>C linked list</span> </div> </a> <ul id="toc-C_linked_list-sublist" class="vector-toc-list"> </ul> </li> </ul> </li> <li id="toc-Pass-by-address_using_pointers" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Pass-by-address_using_pointers"> <div class="vector-toc-text"> <span class="vector-toc-numb">4.3</span> <span>Pass-by-address using pointers</span> </div> </a> <ul id="toc-Pass-by-address_using_pointers-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Dynamic_memory_allocation" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Dynamic_memory_allocation"> <div class="vector-toc-text"> <span class="vector-toc-numb">4.4</span> <span>Dynamic memory allocation</span> </div> </a> <ul id="toc-Dynamic_memory_allocation-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Memory-mapped_hardware" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Memory-mapped_hardware"> <div class="vector-toc-text"> <span class="vector-toc-numb">4.5</span> <span>Memory-mapped hardware</span> </div> </a> <ul id="toc-Memory-mapped_hardware-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Use_in_control_tables" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Use_in_control_tables"> <div class="vector-toc-text"> <span class="vector-toc-numb">4.6</span> <span>Use in control tables</span> </div> </a> <ul id="toc-Use_in_control_tables-sublist" class="vector-toc-list"> </ul> </li> </ul> </li> <li id="toc-Typed_pointers_and_casting" class="vector-toc-list-item vector-toc-level-1"> <a class="vector-toc-link" href="#Typed_pointers_and_casting"> <div class="vector-toc-text"> <span class="vector-toc-numb">5</span> <span>Typed pointers and casting</span> </div> </a> <button aria-controls="toc-Typed_pointers_and_casting-sublist" class="cdx-button cdx-button--weight-quiet cdx-button--icon-only vector-toc-toggle"> <span class="vector-icon mw-ui-icon-wikimedia-expand"></span> <span>Toggle Typed pointers and casting subsection</span> </button> <ul id="toc-Typed_pointers_and_casting-sublist" class="vector-toc-list"> <li id="toc-Value_of_pointers" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Value_of_pointers"> <div class="vector-toc-text"> <span class="vector-toc-numb">5.1</span> <span>Value of pointers</span> </div> </a> <ul id="toc-Value_of_pointers-sublist" class="vector-toc-list"> </ul> </li> </ul> </li> <li id="toc-Making_pointers_safer" class="vector-toc-list-item vector-toc-level-1"> <a class="vector-toc-link" href="#Making_pointers_safer"> <div class="vector-toc-text"> <span class="vector-toc-numb">6</span> <span>Making pointers safer</span> </div> </a> <ul id="toc-Making_pointers_safer-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Special_kinds_of_pointers" class="vector-toc-list-item vector-toc-level-1"> <a class="vector-toc-link" href="#Special_kinds_of_pointers"> <div class="vector-toc-text"> <span class="vector-toc-numb">7</span> <span>Special kinds of pointers</span> </div> </a> <button aria-controls="toc-Special_kinds_of_pointers-sublist" class="cdx-button cdx-button--weight-quiet cdx-button--icon-only vector-toc-toggle"> <span class="vector-icon mw-ui-icon-wikimedia-expand"></span> <span>Toggle Special kinds of pointers subsection</span> </button> <ul id="toc-Special_kinds_of_pointers-sublist" class="vector-toc-list"> <li id="toc-Kinds_defined_by_value" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Kinds_defined_by_value"> <div class="vector-toc-text"> <span class="vector-toc-numb">7.1</span> <span>Kinds defined by value</span> </div> </a> <ul id="toc-Kinds_defined_by_value-sublist" class="vector-toc-list"> <li id="toc-Null_pointer" class="vector-toc-list-item vector-toc-level-3"> <a class="vector-toc-link" href="#Null_pointer"> <div class="vector-toc-text"> <span class="vector-toc-numb">7.1.1</span> <span>Null pointer</span> </div> </a> <ul id="toc-Null_pointer-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Dangling_pointer" class="vector-toc-list-item vector-toc-level-3"> <a class="vector-toc-link" href="#Dangling_pointer"> <div class="vector-toc-text"> <span class="vector-toc-numb">7.1.2</span> <span>Dangling pointer</span> </div> </a> <ul id="toc-Dangling_pointer-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Wild_branch" class="vector-toc-list-item vector-toc-level-3"> <a class="vector-toc-link" href="#Wild_branch"> <div class="vector-toc-text"> <span class="vector-toc-numb">7.1.3</span> <span>Wild branch</span> </div> </a> <ul id="toc-Wild_branch-sublist" class="vector-toc-list"> </ul> </li> </ul> </li> <li id="toc-Kinds_defined_by_structure" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Kinds_defined_by_structure"> <div class="vector-toc-text"> <span class="vector-toc-numb">7.2</span> <span>Kinds defined by structure</span> </div> </a> <ul id="toc-Kinds_defined_by_structure-sublist" class="vector-toc-list"> <li id="toc-Autorelative_pointer" class="vector-toc-list-item vector-toc-level-3"> <a class="vector-toc-link" href="#Autorelative_pointer"> <div class="vector-toc-text"> <span class="vector-toc-numb">7.2.1</span> <span>Autorelative pointer</span> </div> </a> <ul id="toc-Autorelative_pointer-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Based_pointer" class="vector-toc-list-item vector-toc-level-3"> <a class="vector-toc-link" href="#Based_pointer"> <div class="vector-toc-text"> <span class="vector-toc-numb">7.2.2</span> <span>Based pointer</span> </div> </a> <ul id="toc-Based_pointer-sublist" class="vector-toc-list"> </ul> </li> </ul> </li> <li id="toc-Kinds_defined_by_use_or_datatype" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Kinds_defined_by_use_or_datatype"> <div class="vector-toc-text"> <span class="vector-toc-numb">7.3</span> <span>Kinds defined by use or datatype</span> </div> </a> <ul id="toc-Kinds_defined_by_use_or_datatype-sublist" class="vector-toc-list"> <li id="toc-Multiple_indirection" class="vector-toc-list-item vector-toc-level-3"> <a class="vector-toc-link" href="#Multiple_indirection"> <div class="vector-toc-text"> <span class="vector-toc-numb">7.3.1</span> <span>Multiple indirection</span> </div> </a> <ul id="toc-Multiple_indirection-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Function_pointer" class="vector-toc-list-item vector-toc-level-3"> <a class="vector-toc-link" href="#Function_pointer"> <div class="vector-toc-text"> <span class="vector-toc-numb">7.3.2</span> <span>Function pointer</span> </div> </a> <ul id="toc-Function_pointer-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Back_pointer" class="vector-toc-list-item vector-toc-level-3"> <a class="vector-toc-link" href="#Back_pointer"> <div class="vector-toc-text"> <span class="vector-toc-numb">7.3.3</span> <span>Back pointer</span> </div> </a> <ul id="toc-Back_pointer-sublist" class="vector-toc-list"> </ul> </li> </ul> </li> </ul> </li> <li id="toc-Simulation_using_an_array_index" class="vector-toc-list-item vector-toc-level-1"> <a class="vector-toc-link" href="#Simulation_using_an_array_index"> <div class="vector-toc-text"> <span class="vector-toc-numb">8</span> <span>Simulation using an array index</span> </div> </a> <ul id="toc-Simulation_using_an_array_index-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Support_in_various_programming_languages" class="vector-toc-list-item vector-toc-level-1"> <a class="vector-toc-link" href="#Support_in_various_programming_languages"> <div class="vector-toc-text"> <span class="vector-toc-numb">9</span> <span>Support in various programming languages</span> </div> </a> <button aria-controls="toc-Support_in_various_programming_languages-sublist" class="cdx-button cdx-button--weight-quiet cdx-button--icon-only vector-toc-toggle"> <span class="vector-icon mw-ui-icon-wikimedia-expand"></span> <span>Toggle Support in various programming languages subsection</span> </button> <ul id="toc-Support_in_various_programming_languages-sublist" class="vector-toc-list"> <li id="toc-Ada" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Ada"> <div class="vector-toc-text"> <span class="vector-toc-numb">9.1</span> <span>Ada</span> </div> </a> <ul id="toc-Ada-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-BASIC" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#BASIC"> <div class="vector-toc-text"> <span class="vector-toc-numb">9.2</span> <span>BASIC</span> </div> </a> <ul id="toc-BASIC-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-C_and_C++" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#C_and_C++"> <div class="vector-toc-text"> <span class="vector-toc-numb">9.3</span> <span>C and C++</span> </div> </a> <ul id="toc-C_and_C++-sublist" class="vector-toc-list"> <li id="toc-Pointer-to-member" class="vector-toc-list-item vector-toc-level-3"> <a class="vector-toc-link" href="#Pointer-to-member"> <div class="vector-toc-text"> <span class="vector-toc-numb">9.3.1</span> <span>Pointer-to-member</span> </div> </a> <ul id="toc-Pointer-to-member-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Pointer_declaration_syntax_overview" class="vector-toc-list-item vector-toc-level-3"> <a class="vector-toc-link" href="#Pointer_declaration_syntax_overview"> <div class="vector-toc-text"> <span class="vector-toc-numb">9.3.2</span> <span>Pointer declaration syntax overview</span> </div> </a> <ul id="toc-Pointer_declaration_syntax_overview-sublist" class="vector-toc-list"> </ul> </li> </ul> </li> <li id="toc-C#" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#C#"> <div class="vector-toc-text"> <span class="vector-toc-numb">9.4</span> <span>C#</span> </div> </a> <ul id="toc-C#-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-COBOL" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#COBOL"> <div class="vector-toc-text"> <span class="vector-toc-numb">9.5</span> <span>COBOL</span> </div> </a> <ul id="toc-COBOL-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-PL/I" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#PL/I"> <div class="vector-toc-text"> <span class="vector-toc-numb">9.6</span> <span>PL/I</span> </div> </a> <ul id="toc-PL/I-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-D" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#D"> <div class="vector-toc-text"> <span class="vector-toc-numb">9.7</span> <span>D</span> </div> </a> <ul id="toc-D-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Eiffel" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Eiffel"> <div class="vector-toc-text"> <span class="vector-toc-numb">9.8</span> <span>Eiffel</span> </div> </a> <ul id="toc-Eiffel-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Fortran" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Fortran"> <div class="vector-toc-text"> <span class="vector-toc-numb">9.9</span> <span>Fortran</span> </div> </a> <ul id="toc-Fortran-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Go" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Go"> <div class="vector-toc-text"> <span class="vector-toc-numb">9.10</span> <span>Go</span> </div> </a> <ul id="toc-Go-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Java" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Java"> <div class="vector-toc-text"> <span class="vector-toc-numb">9.11</span> <span>Java</span> </div> </a> <ul id="toc-Java-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Modula-2" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Modula-2"> <div class="vector-toc-text"> <span class="vector-toc-numb">9.12</span> <span>Modula-2</span> </div> </a> <ul id="toc-Modula-2-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Oberon" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Oberon"> <div class="vector-toc-text"> <span class="vector-toc-numb">9.13</span> <span>Oberon</span> </div> </a> <ul id="toc-Oberon-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Pascal" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Pascal"> <div class="vector-toc-text"> <span class="vector-toc-numb">9.14</span> <span>Pascal</span> </div> </a> <ul id="toc-Pascal-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Perl" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Perl"> <div class="vector-toc-text"> <span class="vector-toc-numb">9.15</span> <span>Perl</span> </div> </a> <ul id="toc-Perl-sublist" class="vector-toc-list"> </ul> </li> </ul> </li> <li id="toc-See_also" class="vector-toc-list-item vector-toc-level-1"> <a class="vector-toc-link" href="#See_also"> <div class="vector-toc-text"> <span class="vector-toc-numb">10</span> <span>See also</span> </div> </a> <ul id="toc-See_also-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Notes" class="vector-toc-list-item vector-toc-level-1"> <a class="vector-toc-link" href="#Notes"> <div class="vector-toc-text"> <span class="vector-toc-numb">11</span> <span>Notes</span> </div> </a> <ul id="toc-Notes-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-References" class="vector-toc-list-item vector-toc-level-1"> <a class="vector-toc-link" href="#References"> <div class="vector-toc-text"> <span class="vector-toc-numb">12</span> <span>References</span> </div> </a> <ul id="toc-References-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-External_links" class="vector-toc-list-item vector-toc-level-1"> <a class="vector-toc-link" href="#External_links"> <div class="vector-toc-text"> <span class="vector-toc-numb">13</span> <span>External links</span> </div> </a> <ul id="toc-External_links-sublist" class="vector-toc-list"> </ul> </li> </ul> </div> </div> </nav> </div> </div> <div class="mw-content-container"> <main id="content" class="mw-body"> <header class="mw-body-header vector-page-titlebar"> <nav aria-label="Contents" class="vector-toc-landmark"> <div id="vector-page-titlebar-toc" class="vector-dropdown vector-page-titlebar-toc vector-button-flush-left" title="Table of Contents" > <input type="checkbox" id="vector-page-titlebar-toc-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-vector-page-titlebar-toc" class="vector-dropdown-checkbox " aria-label="Toggle the table of contents" > <label id="vector-page-titlebar-toc-label" for="vector-page-titlebar-toc-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only " aria-hidden="true" ><span class="vector-icon mw-ui-icon-listBullet mw-ui-icon-wikimedia-listBullet"></span> <span class="vector-dropdown-label-text">Toggle the table of contents</span> </label> <div class="vector-dropdown-content"> <div id="vector-page-titlebar-toc-unpinned-container" class="vector-unpinned-container"> </div> </div> </div> </nav> <h1 id="firstHeading" class="firstHeading mw-first-heading"><span class="mw-page-title-main">Pointer (computer programming)</span></h1> <div id="p-lang-btn" class="vector-dropdown mw-portlet mw-portlet-lang" > <input type="checkbox" id="p-lang-btn-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-p-lang-btn" class="vector-dropdown-checkbox mw-interlanguage-selector" aria-label="Go to an article in another language. Available in 45 languages" > <label id="p-lang-btn-label" for="p-lang-btn-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--action-progressive mw-portlet-lang-heading-45" aria-hidden="true" ><span class="vector-icon mw-ui-icon-language-progressive mw-ui-icon-wikimedia-language-progressive"></span> <span class="vector-dropdown-label-text">45 languages</span> </label> <div class="vector-dropdown-content"> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li class="interlanguage-link interwiki-ar mw-list-item"><a href="https://ar.wikipedia.org/wiki/%D9%85%D8%A4%D8%B4%D8%B1_(%D8%A8%D8%B1%D9%85%D8%AC%D8%A9)" title="مؤشر (برمجة) – Arabic" lang="ar" hreflang="ar" data-title="مؤشر (برمجة)" data-language-autonym="العربية" data-language-local-name="Arabic" class="interlanguage-link-target"><span>العربية</span></a></li><li class="interlanguage-link interwiki-azb mw-list-item"><a href="https://azb.wikipedia.org/wiki/%DA%AF%D8%A4%D8%B3%D8%AA%D9%87%E2%80%8C%D8%B1%DB%8C%D8%AC%DB%8C%D9%84%D8%B1_(%D8%A8%DB%8C%D9%84%DA%AF%DB%8C%E2%80%8C%D8%B3%D8%A7%DB%8C%D8%A7%D8%B1_%D8%A8%DB%8C%D9%84%DB%8C%D9%85%DB%8C)" title="گؤسته‌ریجیلر (بیلگی‌سایار بیلیمی) – South Azerbaijani" lang="azb" hreflang="azb" data-title="گؤسته‌ریجیلر (بیلگی‌سایار بیلیمی)" data-language-autonym="تۆرکجه" data-language-local-name="South Azerbaijani" class="interlanguage-link-target"><span>تۆرکجه</span></a></li><li class="interlanguage-link interwiki-zh-min-nan mw-list-item"><a href="https://zh-min-nan.wikipedia.org/wiki/Ch%C3%AD-piau" title="Chí-piau – Minnan" lang="nan" hreflang="nan" data-title="Chí-piau" data-language-autonym="閩南語 / Bân-lâm-gú" data-language-local-name="Minnan" class="interlanguage-link-target"><span>閩南語 / Bân-lâm-gú</span></a></li><li class="interlanguage-link interwiki-bg mw-list-item"><a href="https://bg.wikipedia.org/wiki/%D0%A3%D0%BA%D0%B0%D0%B7%D0%B0%D1%82%D0%B5%D0%BB_(%D0%BF%D1%80%D0%BE%D0%B3%D1%80%D0%B0%D0%BC%D0%B8%D1%80%D0%B0%D0%BD%D0%B5)" title="Указател (програмиране) – Bulgarian" lang="bg" hreflang="bg" data-title="Указател (програмиране)" data-language-autonym="Български" data-language-local-name="Bulgarian" class="interlanguage-link-target"><span>Български</span></a></li><li class="interlanguage-link interwiki-ca mw-list-item"><a href="https://ca.wikipedia.org/wiki/Punter_(programaci%C3%B3)" title="Punter (programació) – Catalan" lang="ca" hreflang="ca" data-title="Punter (programació)" data-language-autonym="Català" data-language-local-name="Catalan" class="interlanguage-link-target"><span>Català</span></a></li><li class="interlanguage-link interwiki-cs mw-list-item"><a href="https://cs.wikipedia.org/wiki/Ukazatel_(programov%C3%A1n%C3%AD)" title="Ukazatel (programování) – Czech" lang="cs" hreflang="cs" data-title="Ukazatel (programování)" data-language-autonym="Čeština" data-language-local-name="Czech" class="interlanguage-link-target"><span>Čeština</span></a></li><li class="interlanguage-link interwiki-da mw-list-item"><a href="https://da.wikipedia.org/wiki/Pointer_(programmering)" title="Pointer (programmering) – Danish" lang="da" hreflang="da" data-title="Pointer (programmering)" data-language-autonym="Dansk" data-language-local-name="Danish" class="interlanguage-link-target"><span>Dansk</span></a></li><li class="interlanguage-link interwiki-de mw-list-item"><a href="https://de.wikipedia.org/wiki/Zeiger_(Informatik)" title="Zeiger (Informatik) – German" lang="de" hreflang="de" data-title="Zeiger (Informatik)" data-language-autonym="Deutsch" data-language-local-name="German" class="interlanguage-link-target"><span>Deutsch</span></a></li><li class="interlanguage-link interwiki-et mw-list-item"><a href="https://et.wikipedia.org/wiki/Viit_(informaatika)" title="Viit (informaatika) – Estonian" lang="et" hreflang="et" data-title="Viit (informaatika)" data-language-autonym="Eesti" data-language-local-name="Estonian" class="interlanguage-link-target"><span>Eesti</span></a></li><li class="interlanguage-link interwiki-el mw-list-item"><a href="https://el.wikipedia.org/wiki/%CE%94%CE%B5%CE%AF%CE%BA%CF%84%CE%B7%CF%82_(%CF%80%CE%BB%CE%B7%CF%81%CE%BF%CF%86%CE%BF%CF%81%CE%B9%CE%BA%CE%AE)" title="Δείκτης (πληροφορική) – Greek" lang="el" hreflang="el" data-title="Δείκτης (πληροφορική)" data-language-autonym="Ελληνικά" data-language-local-name="Greek" class="interlanguage-link-target"><span>Ελληνικά</span></a></li><li class="interlanguage-link interwiki-es mw-list-item"><a href="https://es.wikipedia.org/wiki/Puntero_(inform%C3%A1tica)" title="Puntero (informática) – Spanish" lang="es" hreflang="es" data-title="Puntero (informática)" data-language-autonym="Español" data-language-local-name="Spanish" class="interlanguage-link-target"><span>Español</span></a></li><li class="interlanguage-link interwiki-eo mw-list-item"><a href="https://eo.wikipedia.org/wiki/Adresmontrilo" title="Adresmontrilo – Esperanto" lang="eo" hreflang="eo" data-title="Adresmontrilo" data-language-autonym="Esperanto" data-language-local-name="Esperanto" class="interlanguage-link-target"><span>Esperanto</span></a></li><li class="interlanguage-link interwiki-fa mw-list-item"><a href="https://fa.wikipedia.org/wiki/%D8%A7%D8%B4%D8%A7%D8%B1%D9%87%E2%80%8C%DA%AF%D8%B1_(%D8%B9%D9%84%D9%88%D9%85_%D8%B1%D8%A7%DB%8C%D8%A7%D9%86%D9%87)" title="اشاره‌گر (علوم رایانه) – Persian" lang="fa" hreflang="fa" data-title="اشاره‌گر (علوم رایانه)" data-language-autonym="فارسی" data-language-local-name="Persian" class="interlanguage-link-target"><span>فارسی</span></a></li><li class="interlanguage-link interwiki-fr mw-list-item"><a href="https://fr.wikipedia.org/wiki/Pointeur_(programmation)" title="Pointeur (programmation) – French" lang="fr" hreflang="fr" data-title="Pointeur (programmation)" data-language-autonym="Français" data-language-local-name="French" class="interlanguage-link-target"><span>Français</span></a></li><li class="interlanguage-link interwiki-ko mw-list-item"><a href="https://ko.wikipedia.org/wiki/%ED%8F%AC%EC%9D%B8%ED%84%B0_(%ED%94%84%EB%A1%9C%EA%B7%B8%EB%9E%98%EB%B0%8D)" title="포인터 (프로그래밍) – Korean" lang="ko" hreflang="ko" data-title="포인터 (프로그래밍)" data-language-autonym="한국어" data-language-local-name="Korean" class="interlanguage-link-target"><span>한국어</span></a></li><li class="interlanguage-link interwiki-hi mw-list-item"><a href="https://hi.wikipedia.org/wiki/%E0%A4%AA%E0%A4%BE%E0%A4%87%E0%A4%82%E0%A4%9F%E0%A4%B0_(%E0%A4%AA%E0%A5%8D%E0%A4%B0%E0%A5%8B%E0%A4%97%E0%A5%8D%E0%A4%B0%E0%A4%BE%E0%A4%AE%E0%A4%BF%E0%A4%82%E0%A4%97)" title="पाइंटर (प्रोग्रामिंग) – Hindi" lang="hi" hreflang="hi" data-title="पाइंटर (प्रोग्रामिंग)" data-language-autonym="हिन्दी" data-language-local-name="Hindi" class="interlanguage-link-target"><span>हिन्दी</span></a></li><li class="interlanguage-link interwiki-is mw-list-item"><a href="https://is.wikipedia.org/wiki/Bendir" title="Bendir – Icelandic" lang="is" hreflang="is" data-title="Bendir" data-language-autonym="Íslenska" data-language-local-name="Icelandic" class="interlanguage-link-target"><span>Íslenska</span></a></li><li class="interlanguage-link interwiki-it mw-list-item"><a href="https://it.wikipedia.org/wiki/Puntatore_(programmazione)" title="Puntatore (programmazione) – Italian" lang="it" hreflang="it" data-title="Puntatore (programmazione)" data-language-autonym="Italiano" data-language-local-name="Italian" class="interlanguage-link-target"><span>Italiano</span></a></li><li class="interlanguage-link interwiki-he mw-list-item"><a href="https://he.wikipedia.org/wiki/%D7%9E%D7%A6%D7%91%D7%99%D7%A2" title="מצביע – Hebrew" lang="he" hreflang="he" data-title="מצביע" data-language-autonym="עברית" data-language-local-name="Hebrew" class="interlanguage-link-target"><span>עברית</span></a></li><li class="interlanguage-link interwiki-ka mw-list-item"><a href="https://ka.wikipedia.org/wiki/%E1%83%9E%E1%83%9D%E1%83%98%E1%83%9C%E1%83%A2%E1%83%94%E1%83%A0%E1%83%98_(%E1%83%99%E1%83%9D%E1%83%9B%E1%83%9E%E1%83%98%E1%83%A3%E1%83%A2%E1%83%94%E1%83%A0%E1%83%A3%E1%83%9A%E1%83%98_%E1%83%9E%E1%83%A0%E1%83%9D%E1%83%92%E1%83%A0%E1%83%90%E1%83%9B%E1%83%98%E1%83%A0%E1%83%94%E1%83%91%E1%83%90)" title="პოინტერი (კომპიუტერული პროგრამირება) – Georgian" lang="ka" hreflang="ka" data-title="პოინტერი (კომპიუტერული პროგრამირება)" data-language-autonym="ქართული" data-language-local-name="Georgian" class="interlanguage-link-target"><span>ქართული</span></a></li><li class="interlanguage-link interwiki-kk mw-list-item"><a href="https://kk.wikipedia.org/wiki/%D0%9D%D2%B1%D1%81%D2%9B%D0%B0%D2%93%D1%8B%D1%88" title="Нұсқағыш – Kazakh" lang="kk" hreflang="kk" data-title="Нұсқағыш" data-language-autonym="Қазақша" data-language-local-name="Kazakh" class="interlanguage-link-target"><span>Қазақша</span></a></li><li class="interlanguage-link interwiki-ky mw-list-item"><a href="https://ky.wikipedia.org/wiki/%D0%9A%D3%A9%D1%80%D1%81%D3%A9%D1%82%D0%BA%D2%AF%D1%87" title="Көрсөткүч – Kyrgyz" lang="ky" hreflang="ky" data-title="Көрсөткүч" data-language-autonym="Кыргызча" data-language-local-name="Kyrgyz" class="interlanguage-link-target"><span>Кыргызча</span></a></li><li class="interlanguage-link interwiki-lt mw-list-item"><a href="https://lt.wikipedia.org/wiki/Rodykl%C4%97_(programavime)" title="Rodyklė (programavime) – Lithuanian" lang="lt" hreflang="lt" data-title="Rodyklė (programavime)" data-language-autonym="Lietuvių" data-language-local-name="Lithuanian" class="interlanguage-link-target"><span>Lietuvių</span></a></li><li class="interlanguage-link interwiki-lmo mw-list-item"><a href="https://lmo.wikipedia.org/wiki/Pontator_(programmazion)" title="Pontator (programmazion) – Lombard" lang="lmo" hreflang="lmo" data-title="Pontator (programmazion)" data-language-autonym="Lombard" data-language-local-name="Lombard" class="interlanguage-link-target"><span>Lombard</span></a></li><li class="interlanguage-link interwiki-hu mw-list-item"><a href="https://hu.wikipedia.org/wiki/Mutat%C3%B3_(programoz%C3%A1s)" title="Mutató (programozás) – Hungarian" lang="hu" hreflang="hu" data-title="Mutató (programozás)" data-language-autonym="Magyar" data-language-local-name="Hungarian" class="interlanguage-link-target"><span>Magyar</span></a></li><li class="interlanguage-link interwiki-ml mw-list-item"><a href="https://ml.wikipedia.org/wiki/%E0%B4%AA%E0%B5%8B%E0%B4%AF%E0%B4%BF%E0%B4%A8%E0%B5%8D%E0%B4%B1%E0%B5%BC" title="പോയിന്റർ – Malayalam" lang="ml" hreflang="ml" data-title="പോയിന്റർ" data-language-autonym="മലയാളം" data-language-local-name="Malayalam" class="interlanguage-link-target"><span>മലയാളം</span></a></li><li class="interlanguage-link interwiki-ms mw-list-item"><a href="https://ms.wikipedia.org/wiki/Penuding_(pengkomputeran)" title="Penuding (pengkomputeran) – Malay" lang="ms" hreflang="ms" data-title="Penuding (pengkomputeran)" data-language-autonym="Bahasa Melayu" data-language-local-name="Malay" class="interlanguage-link-target"><span>Bahasa Melayu</span></a></li><li class="interlanguage-link interwiki-nl mw-list-item"><a href="https://nl.wikipedia.org/wiki/Pointer_(programmeerconcept)" title="Pointer (programmeerconcept) – Dutch" lang="nl" hreflang="nl" data-title="Pointer (programmeerconcept)" data-language-autonym="Nederlands" data-language-local-name="Dutch" class="interlanguage-link-target"><span>Nederlands</span></a></li><li class="interlanguage-link interwiki-ja mw-list-item"><a href="https://ja.wikipedia.org/wiki/%E3%83%9D%E3%82%A4%E3%83%B3%E3%82%BF_(%E3%83%97%E3%83%AD%E3%82%B0%E3%83%A9%E3%83%9F%E3%83%B3%E3%82%B0)" title="ポインタ (プログラミング) – Japanese" lang="ja" hreflang="ja" data-title="ポインタ (プログラミング)" data-language-autonym="日本語" data-language-local-name="Japanese" class="interlanguage-link-target"><span>日本語</span></a></li><li class="interlanguage-link interwiki-pl mw-list-item"><a href="https://pl.wikipedia.org/wiki/Wska%C5%BAnik_(typ_danych)" title="Wskaźnik (typ danych) – Polish" lang="pl" hreflang="pl" data-title="Wskaźnik (typ danych)" data-language-autonym="Polski" data-language-local-name="Polish" class="interlanguage-link-target"><span>Polski</span></a></li><li class="interlanguage-link interwiki-pt mw-list-item"><a href="https://pt.wikipedia.org/wiki/Ponteiro_(programa%C3%A7%C3%A3o)" title="Ponteiro (programação) – Portuguese" lang="pt" hreflang="pt" data-title="Ponteiro (programação)" data-language-autonym="Português" data-language-local-name="Portuguese" class="interlanguage-link-target"><span>Português</span></a></li><li class="interlanguage-link interwiki-ru mw-list-item"><a href="https://ru.wikipedia.org/wiki/%D0%A3%D0%BA%D0%B0%D0%B7%D0%B0%D1%82%D0%B5%D0%BB%D1%8C_(%D1%82%D0%B8%D0%BF_%D0%B4%D0%B0%D0%BD%D0%BD%D1%8B%D1%85)" title="Указатель (тип данных) – Russian" lang="ru" hreflang="ru" data-title="Указатель (тип данных)" data-language-autonym="Русский" data-language-local-name="Russian" class="interlanguage-link-target"><span>Русский</span></a></li><li class="interlanguage-link interwiki-sq mw-list-item"><a href="https://sq.wikipedia.org/wiki/Pointeri" title="Pointeri – Albanian" lang="sq" hreflang="sq" data-title="Pointeri" data-language-autonym="Shqip" data-language-local-name="Albanian" class="interlanguage-link-target"><span>Shqip</span></a></li><li class="interlanguage-link interwiki-simple mw-list-item"><a href="https://simple.wikipedia.org/wiki/Pointer_(computer_programming)" title="Pointer (computer programming) – Simple English" lang="en-simple" hreflang="en-simple" data-title="Pointer (computer programming)" data-language-autonym="Simple English" data-language-local-name="Simple English" class="interlanguage-link-target"><span>Simple English</span></a></li><li class="interlanguage-link interwiki-sk mw-list-item"><a href="https://sk.wikipedia.org/wiki/Ukazovate%C4%BE_(informatika)" title="Ukazovateľ (informatika) – Slovak" lang="sk" hreflang="sk" data-title="Ukazovateľ (informatika)" data-language-autonym="Slovenčina" data-language-local-name="Slovak" class="interlanguage-link-target"><span>Slovenčina</span></a></li><li class="interlanguage-link interwiki-sr mw-list-item"><a href="https://sr.wikipedia.org/wiki/%D0%9F%D0%BE%D0%BA%D0%B0%D0%B7%D0%B8%D0%B2%D0%B0%D1%87_(%D0%BF%D1%80%D0%BE%D0%B3%D1%80%D0%B0%D0%BC%D0%B8%D1%80%D0%B0%D1%9A%D0%B5)" title="Показивач (програмирање) – Serbian" lang="sr" hreflang="sr" data-title="Показивач (програмирање)" data-language-autonym="Српски / srpski" data-language-local-name="Serbian" class="interlanguage-link-target"><span>Српски / srpski</span></a></li><li class="interlanguage-link interwiki-sh mw-list-item"><a href="https://sh.wikipedia.org/wiki/Pokaziva%C4%8D_(programiranje)" title="Pokazivač (programiranje) – Serbo-Croatian" lang="sh" hreflang="sh" data-title="Pokazivač (programiranje)" data-language-autonym="Srpskohrvatski / српскохрватски" data-language-local-name="Serbo-Croatian" class="interlanguage-link-target"><span>Srpskohrvatski / српскохрватски</span></a></li><li class="interlanguage-link interwiki-fi mw-list-item"><a href="https://fi.wikipedia.org/wiki/Osoitin_(ohjelmointi)" title="Osoitin (ohjelmointi) – Finnish" lang="fi" hreflang="fi" data-title="Osoitin (ohjelmointi)" data-language-autonym="Suomi" data-language-local-name="Finnish" class="interlanguage-link-target"><span>Suomi</span></a></li><li class="interlanguage-link interwiki-sv mw-list-item"><a href="https://sv.wikipedia.org/wiki/Datatyp#Pekare_och_referenstyper" title="Datatyp – Swedish" lang="sv" hreflang="sv" data-title="Datatyp" data-language-autonym="Svenska" data-language-local-name="Swedish" class="interlanguage-link-target"><span>Svenska</span></a></li><li class="interlanguage-link interwiki-ta mw-list-item"><a href="https://ta.wikipedia.org/wiki/%E0%AE%9A%E0%AF%81%E0%AE%9F%E0%AF%8D%E0%AE%9F%E0%AF%81_(%E0%AE%A8%E0%AE%BF%E0%AE%B0%E0%AE%B2%E0%AE%BE%E0%AE%95%E0%AF%8D%E0%AE%95%E0%AE%AE%E0%AF%8D)" title="சுட்டு (நிரலாக்கம்) – Tamil" lang="ta" hreflang="ta" data-title="சுட்டு (நிரலாக்கம்)" data-language-autonym="தமிழ்" data-language-local-name="Tamil" class="interlanguage-link-target"><span>தமிழ்</span></a></li><li class="interlanguage-link interwiki-tr mw-list-item"><a href="https://tr.wikipedia.org/wiki/%C4%B0%C5%9Faret%C3%A7i_(bilgisayar_programlama)" title="İşaretçi (bilgisayar programlama) – Turkish" lang="tr" hreflang="tr" data-title="İşaretçi (bilgisayar programlama)" data-language-autonym="Türkçe" data-language-local-name="Turkish" class="interlanguage-link-target"><span>Türkçe</span></a></li><li class="interlanguage-link interwiki-uk mw-list-item"><a href="https://uk.wikipedia.org/wiki/%D0%92%D0%BA%D0%B0%D0%B7%D1%96%D0%B2%D0%BD%D0%B8%D0%BA" title="Вказівник – Ukrainian" lang="uk" hreflang="uk" data-title="Вказівник" data-language-autonym="Українська" data-language-local-name="Ukrainian" class="interlanguage-link-target"><span>Українська</span></a></li><li class="interlanguage-link interwiki-vi mw-list-item"><a href="https://vi.wikipedia.org/wiki/Con_tr%E1%BB%8F_(l%E1%BA%ADp_tr%C3%ACnh_m%C3%A1y_t%C3%ADnh)" title="Con trỏ (lập trình máy tính) – Vietnamese" lang="vi" hreflang="vi" data-title="Con trỏ (lập trình máy tính)" data-language-autonym="Tiếng Việt" data-language-local-name="Vietnamese" class="interlanguage-link-target"><span>Tiếng Việt</span></a></li><li class="interlanguage-link interwiki-zh-yue mw-list-item"><a href="https://zh-yue.wikipedia.org/wiki/%E6%8C%87%E6%A8%99_(%E9%9B%BB%E8%85%A6%E7%A7%91%E5%AD%B8)" title="指標 (電腦科學) – Cantonese" lang="yue" hreflang="yue" data-title="指標 (電腦科學)" data-language-autonym="粵語" data-language-local-name="Cantonese" class="interlanguage-link-target"><span>粵語</span></a></li><li class="interlanguage-link interwiki-zh mw-list-item"><a href="https://zh.wikipedia.org/wiki/%E6%8C%87%E6%A8%99_(%E9%9B%BB%E8%85%A6%E7%A7%91%E5%AD%B8)" title="指標 (電腦科學) – Chinese" lang="zh" hreflang="zh" data-title="指標 (電腦科學)" data-language-autonym="中文" data-language-local-name="Chinese" class="interlanguage-link-target"><span>中文</span></a></li> </ul> <div class="after-portlet after-portlet-lang"><span class="wb-langlinks-edit wb-langlinks-link"><a href="https://www.wikidata.org/wiki/Special:EntityPage/Q118155#sitelinks-wikipedia" title="Edit interlanguage links" class="wbc-editpage">Edit links</a></span></div> </div> </div> </div> </header> <div class="vector-page-toolbar"> <div class="vector-page-toolbar-container"> <div id="left-navigation"> <nav aria-label="Namespaces"> <div id="p-associated-pages" class="vector-menu vector-menu-tabs mw-portlet mw-portlet-associated-pages" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="ca-nstab-main" class="selected vector-tab-noicon mw-list-item"><a href="/wiki/Pointer_(computer_programming)" title="View the content page [c]" accesskey="c"><span>Article</span></a></li><li id="ca-talk" class="vector-tab-noicon mw-list-item"><a href="/wiki/Talk:Pointer_(computer_programming)" rel="discussion" title="Discuss improvements to the content page [t]" accesskey="t"><span>Talk</span></a></li> </ul> </div> </div> <div id="vector-variants-dropdown" class="vector-dropdown emptyPortlet" > <input type="checkbox" id="vector-variants-dropdown-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-vector-variants-dropdown" class="vector-dropdown-checkbox " aria-label="Change language variant" > <label id="vector-variants-dropdown-label" for="vector-variants-dropdown-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet" aria-hidden="true" ><span class="vector-dropdown-label-text">English</span> </label> <div class="vector-dropdown-content"> <div id="p-variants" class="vector-menu mw-portlet mw-portlet-variants emptyPortlet" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> </ul> </div> </div> </div> </div> </nav> </div> <div id="right-navigation" class="vector-collapsible"> <nav aria-label="Views"> <div id="p-views" class="vector-menu vector-menu-tabs mw-portlet mw-portlet-views" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="ca-view" class="selected vector-tab-noicon mw-list-item"><a href="/wiki/Pointer_(computer_programming)"><span>Read</span></a></li><li id="ca-edit" class="vector-tab-noicon mw-list-item"><a href="/w/index.php?title=Pointer_(computer_programming)&amp;action=edit" title="Edit this page [e]" accesskey="e"><span>Edit</span></a></li><li id="ca-history" class="vector-tab-noicon mw-list-item"><a href="/w/index.php?title=Pointer_(computer_programming)&amp;action=history" title="Past revisions of this page [h]" accesskey="h"><span>View history</span></a></li> </ul> </div> </div> </nav> <nav class="vector-page-tools-landmark" aria-label="Page tools"> <div id="vector-page-tools-dropdown" class="vector-dropdown vector-page-tools-dropdown" > <input type="checkbox" id="vector-page-tools-dropdown-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-vector-page-tools-dropdown" class="vector-dropdown-checkbox " aria-label="Tools" > <label id="vector-page-tools-dropdown-label" for="vector-page-tools-dropdown-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet" aria-hidden="true" ><span class="vector-dropdown-label-text">Tools</span> </label> <div class="vector-dropdown-content"> <div id="vector-page-tools-unpinned-container" class="vector-unpinned-container"> <div id="vector-page-tools" class="vector-page-tools vector-pinnable-element"> <div class="vector-pinnable-header vector-page-tools-pinnable-header vector-pinnable-header-unpinned" data-feature-name="page-tools-pinned" data-pinnable-element-id="vector-page-tools" data-pinned-container-id="vector-page-tools-pinned-container" data-unpinned-container-id="vector-page-tools-unpinned-container" > <div class="vector-pinnable-header-label">Tools</div> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-pin-button" data-event-name="pinnable-header.vector-page-tools.pin">move to sidebar</button> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-unpin-button" data-event-name="pinnable-header.vector-page-tools.unpin">hide</button> </div> <div id="p-cactions" class="vector-menu mw-portlet mw-portlet-cactions emptyPortlet vector-has-collapsible-items" title="More options" > <div class="vector-menu-heading"> Actions </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="ca-more-view" class="selected vector-more-collapsible-item mw-list-item"><a href="/wiki/Pointer_(computer_programming)"><span>Read</span></a></li><li id="ca-more-edit" class="vector-more-collapsible-item mw-list-item"><a href="/w/index.php?title=Pointer_(computer_programming)&amp;action=edit" title="Edit this page [e]" accesskey="e"><span>Edit</span></a></li><li id="ca-more-history" class="vector-more-collapsible-item mw-list-item"><a href="/w/index.php?title=Pointer_(computer_programming)&amp;action=history"><span>View history</span></a></li> </ul> </div> </div> <div id="p-tb" class="vector-menu mw-portlet mw-portlet-tb" > <div class="vector-menu-heading"> General </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="t-whatlinkshere" class="mw-list-item"><a href="/wiki/Special:WhatLinksHere/Pointer_(computer_programming)" title="List of all English Wikipedia pages containing links to this page [j]" accesskey="j"><span>What links here</span></a></li><li id="t-recentchangeslinked" class="mw-list-item"><a href="/wiki/Special:RecentChangesLinked/Pointer_(computer_programming)" rel="nofollow" title="Recent changes in pages linked from this page [k]" accesskey="k"><span>Related changes</span></a></li><li id="t-upload" class="mw-list-item"><a href="//en.wikipedia.org/wiki/Wikipedia:File_Upload_Wizard" title="Upload files [u]" accesskey="u"><span>Upload file</span></a></li><li id="t-permalink" class="mw-list-item"><a href="/w/index.php?title=Pointer_(computer_programming)&amp;oldid=1281405968" title="Permanent link to this revision of this page"><span>Permanent link</span></a></li><li id="t-info" class="mw-list-item"><a href="/w/index.php?title=Pointer_(computer_programming)&amp;action=info" title="More information about this page"><span>Page information</span></a></li><li id="t-cite" class="mw-list-item"><a href="/w/index.php?title=Special:CiteThisPage&amp;page=Pointer_%28computer_programming%29&amp;id=1281405968&amp;wpFormIdentifier=titleform" title="Information on how to cite this page"><span>Cite this page</span></a></li><li id="t-urlshortener" class="mw-list-item"><a href="/w/index.php?title=Special:UrlShortener&amp;url=https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FPointer_%28computer_programming%29"><span>Get shortened URL</span></a></li><li id="t-urlshortener-qrcode" class="mw-list-item"><a href="/w/index.php?title=Special:QrCode&amp;url=https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FPointer_%28computer_programming%29"><span>Download QR code</span></a></li> </ul> </div> </div> <div id="p-coll-print_export" class="vector-menu mw-portlet mw-portlet-coll-print_export" > <div class="vector-menu-heading"> Print/export </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="coll-download-as-rl" class="mw-list-item"><a href="/w/index.php?title=Special:DownloadAsPdf&amp;page=Pointer_%28computer_programming%29&amp;action=show-download-screen" title="Download this page as a PDF file"><span>Download as PDF</span></a></li><li id="t-print" class="mw-list-item"><a href="/w/index.php?title=Pointer_(computer_programming)&amp;printable=yes" title="Printable version of this page [p]" accesskey="p"><span>Printable version</span></a></li> </ul> </div> </div> <div id="p-wikibase-otherprojects" class="vector-menu mw-portlet mw-portlet-wikibase-otherprojects" > <div class="vector-menu-heading"> In other projects </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li class="wb-otherproject-link wb-otherproject-commons mw-list-item"><a href="https://commons.wikimedia.org/wiki/Category:Pointers_(computing)" hreflang="en"><span>Wikimedia Commons</span></a></li><li class="wb-otherproject-link wb-otherproject-wikibooks mw-list-item"><a href="https://en.wikibooks.org/wiki/C%2B%2B_Programming/Operators/Pointers" hreflang="en"><span>Wikibooks</span></a></li><li class="wb-otherproject-link wb-otherproject-wikiversity mw-list-item"><a href="https://en.wikiversity.org/wiki/C%2B%2B/Pointers" hreflang="en"><span>Wikiversity</span></a></li><li id="t-wikibase" class="wb-otherproject-link wb-otherproject-wikibase-dataitem mw-list-item"><a href="https://www.wikidata.org/wiki/Special:EntityPage/Q118155" title="Structured data on this page hosted by Wikidata [g]" accesskey="g"><span>Wikidata item</span></a></li> </ul> </div> </div> </div> </div> </div> </div> </nav> </div> </div> </div> <div class="vector-column-end"> <div class="vector-sticky-pinned-container"> <nav class="vector-page-tools-landmark" aria-label="Page tools"> <div id="vector-page-tools-pinned-container" class="vector-pinned-container"> </div> </nav> <nav class="vector-appearance-landmark" aria-label="Appearance"> <div id="vector-appearance-pinned-container" class="vector-pinned-container"> <div id="vector-appearance" class="vector-appearance vector-pinnable-element"> <div class="vector-pinnable-header vector-appearance-pinnable-header vector-pinnable-header-pinned" data-feature-name="appearance-pinned" data-pinnable-element-id="vector-appearance" data-pinned-container-id="vector-appearance-pinned-container" data-unpinned-container-id="vector-appearance-unpinned-container" > <div class="vector-pinnable-header-label">Appearance</div> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-pin-button" data-event-name="pinnable-header.vector-appearance.pin">move to sidebar</button> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-unpin-button" data-event-name="pinnable-header.vector-appearance.unpin">hide</button> </div> </div> </div> </nav> </div> </div> <div id="bodyContent" class="vector-body" aria-labelledby="firstHeading" data-mw-ve-target-container> <div class="vector-body-before-content"> <div class="mw-indicators"> </div> <div id="siteSub" class="noprint">From Wikipedia, the free encyclopedia</div> </div> <div id="contentSub"><div id="mw-content-subtitle"><span class="mw-redirectedfrom">(Redirected from <a href="/w/index.php?title=Dereference_operator&amp;redirect=no" class="mw-redirect" title="Dereference operator">Dereference operator</a>)</span></div></div> <div id="mw-content-text" class="mw-body-content"><div class="mw-content-ltr mw-parser-output" lang="en" dir="ltr"><div class="shortdescription nomobile noexcerpt noprint searchaux" style="display:none">Object which stores memory addresses in a computer program</div> <style data-mw-deduplicate="TemplateStyles:r1236090951">.mw-parser-output .hatnote{font-style:italic}.mw-parser-output div.hatnote{padding-left:1.6em;margin-bottom:0.5em}.mw-parser-output .hatnote i{font-style:normal}.mw-parser-output .hatnote+link+.hatnote{margin-top:-0.5em}@media print{body.ns-0 .mw-parser-output .hatnote{display:none!important}}</style><div role="note" class="hatnote navigation-not-searchable">For other uses, see <a href="/wiki/Pointer_(disambiguation)" class="mw-redirect mw-disambig" title="Pointer (disambiguation)">Pointer (disambiguation)</a>.</div> <style data-mw-deduplicate="TemplateStyles:r1251242444">.mw-parser-output .ambox{border:1px solid #a2a9b1;border-left:10px solid #36c;background-color:#fbfbfb;box-sizing:border-box}.mw-parser-output .ambox+link+.ambox,.mw-parser-output .ambox+link+style+.ambox,.mw-parser-output .ambox+link+link+.ambox,.mw-parser-output .ambox+.mw-empty-elt+link+.ambox,.mw-parser-output .ambox+.mw-empty-elt+link+style+.ambox,.mw-parser-output .ambox+.mw-empty-elt+link+link+.ambox{margin-top:-1px}html body.mediawiki .mw-parser-output .ambox.mbox-small-left{margin:4px 1em 4px 0;overflow:hidden;width:238px;border-collapse:collapse;font-size:88%;line-height:1.25em}.mw-parser-output .ambox-speedy{border-left:10px solid #b32424;background-color:#fee7e6}.mw-parser-output .ambox-delete{border-left:10px solid #b32424}.mw-parser-output .ambox-content{border-left:10px solid #f28500}.mw-parser-output .ambox-style{border-left:10px solid #fc3}.mw-parser-output .ambox-move{border-left:10px solid #9932cc}.mw-parser-output .ambox-protection{border-left:10px solid #a2a9b1}.mw-parser-output .ambox .mbox-text{border:none;padding:0.25em 0.5em;width:100%}.mw-parser-output .ambox .mbox-image{border:none;padding:2px 0 2px 0.5em;text-align:center}.mw-parser-output .ambox .mbox-imageright{border:none;padding:2px 0.5em 2px 0;text-align:center}.mw-parser-output .ambox .mbox-empty-cell{border:none;padding:0;width:1px}.mw-parser-output .ambox .mbox-image-div{width:52px}@media(min-width:720px){.mw-parser-output .ambox{margin:0 10%}}@media print{body.ns-0 .mw-parser-output .ambox{display:none!important}}</style><table class="box-More_citations_needed plainlinks metadata ambox ambox-content ambox-Refimprove" role="presentation"><tbody><tr><td class="mbox-image"><div class="mbox-image-div"><span typeof="mw:File"><a href="/wiki/File:Question_book-new.svg" class="mw-file-description"><img alt="" src="//upload.wikimedia.org/wikipedia/en/thumb/9/99/Question_book-new.svg/50px-Question_book-new.svg.png" decoding="async" width="50" height="39" class="mw-file-element" srcset="//upload.wikimedia.org/wikipedia/en/thumb/9/99/Question_book-new.svg/75px-Question_book-new.svg.png 1.5x, //upload.wikimedia.org/wikipedia/en/thumb/9/99/Question_book-new.svg/100px-Question_book-new.svg.png 2x" data-file-width="512" data-file-height="399" /></a></span></div></td><td class="mbox-text"><div class="mbox-text-span">This article <b>needs additional citations for <a href="/wiki/Wikipedia:Verifiability" title="Wikipedia:Verifiability">verification</a></b>.<span class="hide-when-compact"> Please help <a href="/wiki/Special:EditPage/Pointer_(computer_programming)" title="Special:EditPage/Pointer (computer programming)">improve this article</a> by <a href="/wiki/Help:Referencing_for_beginners" title="Help:Referencing for beginners">adding citations to reliable sources</a>. Unsourced material may be challenged and removed.<br /><small><span class="plainlinks"><i>Find sources:</i>&#160;<a rel="nofollow" class="external text" href="https://www.google.com/search?as_eq=wikipedia&amp;q=%22Pointer%22+computer+programming">"Pointer"&#160;computer programming</a>&#160;–&#160;<a rel="nofollow" class="external text" href="https://www.google.com/search?tbm=nws&amp;q=%22Pointer%22+computer+programming+-wikipedia&amp;tbs=ar:1">news</a>&#160;<b>·</b> <a rel="nofollow" class="external text" href="https://www.google.com/search?&amp;q=%22Pointer%22+computer+programming&amp;tbs=bkt:s&amp;tbm=bks">newspapers</a>&#160;<b>·</b> <a rel="nofollow" class="external text" href="https://www.google.com/search?tbs=bks:1&amp;q=%22Pointer%22+computer+programming+-wikipedia">books</a>&#160;<b>·</b> <a rel="nofollow" class="external text" href="https://scholar.google.com/scholar?q=%22Pointer%22+computer+programming">scholar</a>&#160;<b>·</b> <a rel="nofollow" class="external text" href="https://www.jstor.org/action/doBasicSearch?Query=%22Pointer%22+computer+programming&amp;acc=on&amp;wc=on">JSTOR</a></span></small></span> <span class="date-container"><i>(<span class="date">April 2018</span>)</i></span><span class="hide-when-compact"><i> (<small><a href="/wiki/Help:Maintenance_template_removal" title="Help:Maintenance template removal">Learn how and when to remove this message</a></small>)</i></span></div></td></tr></tbody></table> <style data-mw-deduplicate="TemplateStyles:r1224211176">.mw-parser-output .quotebox{background-color:#F9F9F9;border:1px solid #aaa;box-sizing:border-box;padding:10px;font-size:88%;max-width:100%}.mw-parser-output .quotebox.floatleft{margin:.5em 1.4em .8em 0}.mw-parser-output .quotebox.floatright{margin:.5em 0 .8em 1.4em}.mw-parser-output .quotebox.centered{overflow:hidden;position:relative;margin:.5em auto .8em auto}.mw-parser-output .quotebox.floatleft span,.mw-parser-output .quotebox.floatright span{font-style:inherit}.mw-parser-output .quotebox>blockquote{margin:0;padding:0;border-left:0;font-family:inherit;font-size:inherit}.mw-parser-output .quotebox-title{text-align:center;font-size:110%;font-weight:bold}.mw-parser-output .quotebox-quote>:first-child{margin-top:0}.mw-parser-output .quotebox-quote:last-child>:last-child{margin-bottom:0}.mw-parser-output .quotebox-quote.quoted:before{font-family:"Times New Roman",serif;font-weight:bold;font-size:large;color:gray;content:" “ ";vertical-align:-45%;line-height:0}.mw-parser-output .quotebox-quote.quoted:after{font-family:"Times New Roman",serif;font-weight:bold;font-size:large;color:gray;content:" ” ";line-height:0}.mw-parser-output .quotebox .left-aligned{text-align:left}.mw-parser-output .quotebox .right-aligned{text-align:right}.mw-parser-output .quotebox .center-aligned{text-align:center}.mw-parser-output .quotebox .quote-title,.mw-parser-output .quotebox .quotebox-quote{display:block}.mw-parser-output .quotebox cite{display:block;font-style:normal}@media screen and (max-width:640px){.mw-parser-output .quotebox{width:100%!important;margin:0 0 .8em!important;float:none!important}}</style><div class="quotebox pullquote floatright" style="width:33%; ;"> <blockquote class="quotebox-quote left-aligned" style=""> <p>I do consider <a href="/wiki/Assignment_(computer_science)" title="Assignment (computer science)">assignment statements</a> and pointer variables to be among computer science's "most valuable treasures." </p> </blockquote> <div style="padding-bottom: 0; padding-top: 0.5em"><cite class="left-aligned" style=""><a href="/wiki/Donald_Knuth" title="Donald Knuth">Donald Knuth</a>, <i>Structured Programming, with go to Statements</i><sup id="cite_ref-1" class="reference"><a href="#cite_note-1"><span class="cite-bracket">&#91;</span>1<span class="cite-bracket">&#93;</span></a></sup></cite></div> </div> <figure class="mw-default-size" typeof="mw:File/Thumb"><a href="/wiki/File:Pointers.svg" class="mw-file-description"><img src="//upload.wikimedia.org/wikipedia/commons/thumb/b/b4/Pointers.svg/220px-Pointers.svg.png" decoding="async" width="220" height="244" class="mw-file-element" srcset="//upload.wikimedia.org/wikipedia/commons/thumb/b/b4/Pointers.svg/330px-Pointers.svg.png 1.5x, //upload.wikimedia.org/wikipedia/commons/thumb/b/b4/Pointers.svg/440px-Pointers.svg.png 2x" data-file-width="264" data-file-height="293" /></a><figcaption>A pointer <b>a</b> pointing to the memory address associated with a variable <b>b,</b> i.e., <b>a</b> contains the memory address 1008 of the variable <b>b</b>. In this diagram, the computing architecture uses the same <a href="/wiki/Address_space" title="Address space">address space</a> and <a href="#Formal_description">data primitive</a> for both pointers and non-pointers; this need not be the case.</figcaption></figure> <p>In <a href="/wiki/Computer_science" title="Computer science">computer science</a>, a <b>pointer</b> is an <a href="/wiki/Object_(computer_science)" title="Object (computer science)">object</a> in many <a href="/wiki/Programming_language" title="Programming language">programming languages</a> that stores a <a href="/wiki/Memory_address" title="Memory address">memory address</a>. This can be that of another value located in <a href="/wiki/Computer_memory" title="Computer memory">computer memory</a>, or in some cases, that of <a href="/wiki/Memory-mapped_I/O" class="mw-redirect" title="Memory-mapped I/O">memory-mapped</a> <a href="/wiki/Computer_hardware" title="Computer hardware">computer hardware</a>. A pointer <i>references</i> a location in memory, and obtaining the value stored at that location is known as <i>dereferencing</i> the pointer. As an analogy, a page number in a book's index could be considered a pointer to the corresponding page; dereferencing such a pointer would be done by flipping to the page with the given page number and reading the text found on that page. The actual format and content of a pointer variable is dependent on the underlying <a href="/wiki/Computer_architecture" title="Computer architecture">computer architecture</a>. </p><p>Using pointers significantly improves <a href="/wiki/Computer_performance" title="Computer performance">performance</a> for repetitive operations, like traversing <a href="/wiki/Collection_(abstract_data_type)#Linear_collections" title="Collection (abstract data type)">iterable</a> data <a href="/wiki/Data_structure" title="Data structure">structures</a> (e.g. <a href="/wiki/String_algorithms" class="mw-redirect" title="String algorithms">strings</a>, <a href="/wiki/Lookup_table" title="Lookup table">lookup tables</a>, <a href="/wiki/Control_table" title="Control table">control tables</a>, <a href="/wiki/Linked_list" title="Linked list">linked lists</a>, and <a href="/wiki/Tree_(data_structure)" class="mw-redirect" title="Tree (data structure)">tree</a> structures). In particular, it is often much cheaper in time and space to copy and dereference pointers than it is to copy and access the data to which the pointers point. </p><p>Pointers are also used to hold the addresses of entry points for <a href="/wiki/System_call" title="System call">called</a> subroutines in <a href="/wiki/Procedural_programming" title="Procedural programming">procedural programming</a> and for run-time linking to <a href="/wiki/Dynamic_link_library#Explicit_run-time_linking" class="mw-redirect" title="Dynamic link library">dynamic link libraries (DLLs)</a>. In <a href="/wiki/Object-oriented_programming" title="Object-oriented programming">object-oriented programming</a>, <a href="/wiki/Function_pointer" title="Function pointer">pointers to functions</a> are used for <a href="/wiki/Name_binding" title="Name binding">binding</a> <a href="/wiki/Method_(computer_programming)" title="Method (computer programming)">methods</a>, often using <a href="/wiki/Virtual_method_table" title="Virtual method table">virtual method tables</a>. </p><p>A pointer is a simple, more concrete implementation of the more abstract <i><a href="/wiki/Reference_(computer_science)" title="Reference (computer science)">reference</a></i> <a href="/wiki/Data_type" title="Data type">data type</a>. Several languages, especially <a href="/wiki/Low-level_programming_language" title="Low-level programming language">low-level languages</a>, support some type of pointer, although some have more restrictions on their use than others. While "pointer" has been used to refer to references in general, it more properly applies to <a href="/wiki/Data_structures" class="mw-redirect" title="Data structures">data structures</a> whose <a href="/wiki/Application_programming_interface" class="mw-redirect" title="Application programming interface">interface</a> explicitly allows the pointer to be manipulated (arithmetically via <i><style data-mw-deduplicate="TemplateStyles:r1238216509">.mw-parser-output .vanchor>:target~.vanchor-text{background-color:#b1d2ff}@media screen{html.skin-theme-clientpref-night .mw-parser-output .vanchor>:target~.vanchor-text{background-color:#0f4dc9}}@media screen and (prefers-color-scheme:dark){html.skin-theme-clientpref-os .mw-parser-output .vanchor>:target~.vanchor-text{background-color:#0f4dc9}}</style><span class="vanchor"><span id="pointer_arithmetic"></span><span class="vanchor-text">pointer arithmetic</span></span></i>) as a memory address, as opposed to a <a href="/wiki/Magic_cookie" title="Magic cookie">magic cookie</a> or <a href="/wiki/Capability-based_security" title="Capability-based security">capability</a> which does not allow such.<sup class="noprint Inline-Template Template-Fact" style="white-space:nowrap;">&#91;<i><a href="/wiki/Wikipedia:Citation_needed" title="Wikipedia:Citation needed"><span title="This claim needs references to reliable sources. (May 2009)">citation needed</span></a></i>&#93;</sup> Because pointers allow both protected and unprotected access to <a href="/wiki/Memory_address" title="Memory address">memory addresses</a>, there are risks associated with using them, particularly in the latter case. Primitive pointers are often stored in a format similar to an <a href="/wiki/Integer" title="Integer">integer</a>; however, attempting to dereference or "look up" such a pointer whose value is not a valid memory address could cause a program to <a href="/wiki/Crash_(computing)" title="Crash (computing)">crash</a> (or contain invalid data). To alleviate this potential problem, as a matter of <a href="/wiki/Type_safety" title="Type safety">type safety</a>, pointers are considered a separate type parameterized by the type of data they point to, even if the underlying representation is an integer. Other measures may also be taken (such as <a href="/wiki/Data_validation_and_reconciliation" title="Data validation and reconciliation">validation</a> and <a href="/wiki/Bounds_checking" title="Bounds checking">bounds checking</a>), to verify that the pointer variable contains a value that is both a valid memory address and within the numerical range that the processor is capable of addressing. </p> <meta property="mw:PageProp/toc" /> <div class="mw-heading mw-heading2"><h2 id="History">History</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Pointer_(computer_programming)&amp;action=edit&amp;section=1" title="Edit section: History"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>In 1955, Soviet Ukrainian computer scientist <a href="/wiki/Kateryna_Yushchenko_(scientist)" title="Kateryna Yushchenko (scientist)">Kateryna Yushchenko</a> created the <a href="/wiki/Address_(programming_language)" title="Address (programming language)">Address programming language</a> that made possible indirect addressing and addresses of the highest rank – analogous to pointers. This language was widely used on the Soviet Union computers. However, it was unknown outside the Soviet Union and usually <a href="/wiki/Harold_Lawson" title="Harold Lawson">Harold Lawson</a> is credited with the invention, in 1964, of the pointer.<sup id="cite_ref-2" class="reference"><a href="#cite_note-2"><span class="cite-bracket">&#91;</span>2<span class="cite-bracket">&#93;</span></a></sup> In 2000, Lawson was presented the Computer Pioneer Award by the <a href="/wiki/IEEE" class="mw-redirect" title="IEEE">IEEE</a> "[f]or inventing the pointer variable and introducing this concept into PL/I, thus providing for the first time, the capability to flexibly treat linked lists in a general-purpose high-level language".<sup id="cite_ref-3" class="reference"><a href="#cite_note-3"><span class="cite-bracket">&#91;</span>3<span class="cite-bracket">&#93;</span></a></sup> His seminal paper on the concepts appeared in the June 1967 issue of CACM entitled: PL/I List Processing. According to the <a href="/wiki/Oxford_English_Dictionary" title="Oxford English Dictionary">Oxford English Dictionary</a>, the <b>word</b> <i>pointer</i> first appeared in print as a <i>stack pointer</i> in a technical memorandum by the <a href="/wiki/System_Development_Corporation" title="System Development Corporation">System Development Corporation</a>. </p> <div class="mw-heading mw-heading2"><h2 id="Formal_description">Formal description</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Pointer_(computer_programming)&amp;action=edit&amp;section=2" title="Edit section: Formal description"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>In <a href="/wiki/Computer_science" title="Computer science">computer science</a>, a pointer is a kind of <a href="/wiki/Reference_(computer_science)" title="Reference (computer science)">reference</a>. </p><p>A <i>data primitive</i> (or just <i>primitive</i>) is any datum that can be read from or written to <a href="/wiki/Computer_memory" title="Computer memory">computer memory</a> using one memory access (for instance, both a <i><a href="/wiki/Byte" title="Byte">byte</a></i> and a <i><a href="/wiki/Word_(computer_architecture)" title="Word (computer architecture)">word</a></i> are primitives). </p><p>A <i>data aggregate</i> (or just <i>aggregate</i>) is a group of primitives that are <a href="/wiki/Logical_address" title="Logical address">logically</a> 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 <a href="/wiki/Array_data_structure" class="mw-redirect" title="Array data structure"><i>array</i></a>; in a sense, a multi-byte <i>word</i> primitive is an array of bytes, and some programs use words in this way. </p><p>In the context of these definitions, a <i>byte</i> is the smallest primitive; each <a href="/wiki/Memory_address" title="Memory address">memory address</a> specifies a different byte. The memory address of the initial byte of a datum is considered the memory address (or <i>base memory address</i>) of the entire datum. </p><p>A <i>memory pointer</i> (or just <i>pointer</i>) is a primitive, the value of which is intended to be used as a memory address; it is said that <i>a pointer points to a memory address</i>. It is also said that <i>a pointer points to a datum [in memory]</i> when the pointer's value is the datum's memory address. </p><p>More generally, a pointer is a kind of <a href="/wiki/Reference_(computer_science)" title="Reference (computer science)">reference</a>, and it is said that <i>a pointer references a datum stored somewhere in memory</i>; to obtain that datum is <i>to dereference the pointer</i>. 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. </p><p>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 <a href="/wiki/Data_type" title="Data type">data type</a> in <a href="/wiki/Programming_language" title="Programming language">programming languages</a>; in <a href="/wiki/Static_types" class="mw-redirect" title="Static types">statically</a> (or <a href="/wiki/Strong_and_weak_typing" title="Strong and weak typing">strongly</a>) typed programming languages, the <a href="/wiki/Type_system" title="Type system">type</a> of a pointer determines the type of the datum to which the pointer points. </p> <div class="mw-heading mw-heading2"><h2 id="Architectural_roots">Architectural roots</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Pointer_(computer_programming)&amp;action=edit&amp;section=3" title="Edit section: Architectural roots"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>Pointers are a very thin <a href="/wiki/Abstraction_(computer_science)" title="Abstraction (computer science)">abstraction</a> on top of the addressing capabilities provided by most modern <a href="/wiki/Software_architecture" title="Software architecture">architectures</a>. In the simplest scheme, an <i><a href="/wiki/Memory_address" title="Memory address">address</a></i>, or a numeric <a href="/wiki/Array_data_structure" class="mw-redirect" title="Array data structure">index</a>, is assigned to each unit of memory in the system, where the unit is typically either a <a href="/wiki/Byte" title="Byte">byte</a> or a <a href="/wiki/Word_(computer_architecture)" title="Word (computer architecture)">word</a> – depending on whether the architecture is <a href="/wiki/Byte_addressing" title="Byte addressing">byte-addressable</a> or <a href="/wiki/Word-addressable" class="mw-redirect" title="Word-addressable">word-addressable</a> – effectively transforming all of memory into a very large <a href="/wiki/Array_data_structure" class="mw-redirect" title="Array data structure">array</a>. The system would then also provide an operation to retrieve the value stored in the memory unit at a given address (usually utilizing the machine's <a href="/wiki/General-purpose_register" class="mw-redirect" title="General-purpose register">general-purpose registers</a>). </p><p>In the usual case, a pointer is large enough to hold more addresses than there are units of memory in the system. This introduces the possibility that a program may attempt to access an address which corresponds to no unit of memory, either because not enough memory is installed (i.e. beyond the range of available memory) or the architecture does not support such addresses. The first case may, in certain platforms such as the <a href="/wiki/X86" title="X86">Intel x86</a> architecture, be called a <a href="/wiki/Segmentation_fault" title="Segmentation fault">segmentation fault</a> (segfault). The second case is possible in the current implementation of <a href="/wiki/X86-64" title="X86-64">AMD64</a>, where pointers are 64 bit long and addresses only extend to 48 bits. Pointers must conform to certain rules (canonical addresses), so if a non-canonical pointer is dereferenced, the processor raises a <a href="/wiki/General_protection_fault" title="General protection fault">general protection fault</a>. </p><p>On the other hand, some systems have more units of memory than there are addresses. In this case, a more complex scheme such as <a href="/wiki/Memory_segmentation" title="Memory segmentation">memory segmentation</a> or <a href="/wiki/Paging" class="mw-redirect" title="Paging">paging</a> is employed to use different parts of the memory at different times. The last incarnations of the x86 architecture support up to 36 bits of physical memory addresses, which were mapped to the 32-bit linear address space through the <a href="/wiki/Physical_Address_Extension" title="Physical Address Extension">PAE</a> paging mechanism. Thus, only 1/16 of the possible total memory may be accessed at a time. Another example in the same computer family was the 16-bit <a href="/wiki/Protected_mode" title="Protected mode">protected mode</a> of the <a href="/wiki/Intel_80286" title="Intel 80286">80286</a> processor, which, though supporting only 16 MB of physical memory, could access up to 1 GB of virtual memory, but the combination of 16-bit address and segment registers made accessing more than 64 KB in one data structure cumbersome. </p><p>In order to provide a consistent interface, some architectures provide <a href="/wiki/Memory-mapped_I/O" class="mw-redirect" title="Memory-mapped I/O">memory-mapped I/O</a>, which allows some addresses to refer to units of memory while others refer to device registers of other devices in the computer. There are analogous concepts such as file offsets, array indices, and remote object references that serve some of the same purposes as addresses for other types of objects. </p> <div class="mw-heading mw-heading2"><h2 id="Uses">Uses</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Pointer_(computer_programming)&amp;action=edit&amp;section=4" title="Edit section: Uses"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>Pointers are directly supported without restrictions in languages such as <a href="/wiki/PL/I" title="PL/I">PL/I</a>, <a href="/wiki/C_(programming_language)" title="C (programming language)">C</a>, <a href="/wiki/C%2B%2B" title="C++">C++</a>, <a href="/wiki/Pascal_(programming_language)" title="Pascal (programming language)">Pascal</a>, <a href="/wiki/FreeBASIC" title="FreeBASIC">FreeBASIC</a>, and implicitly in most <a href="/wiki/Assembly_language" title="Assembly language">assembly languages</a>. They are used mainly to construct <a href="/wiki/Reference_(computer_science)" title="Reference (computer science)">references</a>, which in turn are fundamental to construct nearly all <a href="/wiki/Data_structure" title="Data structure">data structures</a>, and to pass data between different parts of a program. </p><p>In <a href="/wiki/Functional_programming" title="Functional programming">functional programming</a> languages that rely heavily on lists, data references are managed abstractly by using primitive constructs like <a href="/wiki/Cons" title="Cons">cons</a> and the corresponding elements <a href="/wiki/Car_and_cdr" class="mw-redirect" title="Car and cdr">car and cdr</a>, which can be thought of as specialised pointers to the first and second components of a cons-cell. This gives rise to some of the idiomatic "flavour" of functional programming. By structuring data in such <a href="/wiki/Linked_list" title="Linked list">cons-lists</a>, these languages facilitate <a href="/wiki/Recursion_(computer_science)" title="Recursion (computer science)">recursive</a> means for building and processing data—for example, by recursively accessing the head and tail elements of lists of lists; e.g. "taking the car of the cdr of the cdr". By contrast, memory management based on pointer dereferencing in some approximation of an <a href="/wiki/Array_data_structure" class="mw-redirect" title="Array data structure">array</a> of memory addresses facilitates treating variables as slots into which data can be assigned <a href="/wiki/Imperative_programming" title="Imperative programming">imperatively</a>. </p><p>When dealing with arrays, the critical <a href="/wiki/Lookup_table" title="Lookup table">lookup</a> operation typically involves a stage called <i>address calculation</i> which involves constructing a pointer to the desired data element in the array. In other data structures, such as <a href="/wiki/Linked_list" title="Linked list">linked lists</a>, pointers are used as references to explicitly tie one piece of the structure to another. </p><p>Pointers are used to pass parameters by reference. This is useful if the programmer wants a function's modifications to a parameter to be visible to the function's caller. This is also useful for returning multiple values from a function. </p><p>Pointers can also be used to <a href="/wiki/Memory_allocation" class="mw-redirect" title="Memory allocation">allocate</a> and deallocate dynamic variables and arrays in memory. Since a variable will often become redundant after it has served its purpose, it is a waste of memory to keep it, and therefore it is good practice to deallocate it (using the original pointer reference) when it is no longer needed. Failure to do so may result in a <i><a href="/wiki/Memory_leak" title="Memory leak">memory leak</a></i> (where available free memory gradually, or in severe cases rapidly, diminishes because of an accumulation of numerous redundant memory blocks). </p> <div class="mw-heading mw-heading3"><h3 id="C_pointers">C pointers</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Pointer_(computer_programming)&amp;action=edit&amp;section=5" title="Edit section: C pointers"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>The basic <a href="/wiki/Syntax_(programming_languages)" title="Syntax (programming languages)">syntax</a> to define a pointer is:<sup id="cite_ref-4" class="reference"><a href="#cite_note-4"><span class="cite-bracket">&#91;</span>4<span class="cite-bracket">&#93;</span></a></sup> </p> <div class="mw-highlight mw-highlight-lang-c mw-content-ltr" dir="ltr"><pre><span></span><span class="kt">int</span><span class="w"> </span><span class="o">*</span><span class="n">ptr</span><span class="p">;</span> </pre></div> <p>This declares <code>ptr</code> as the identifier of an object of the following type: </p> <ul><li>pointer that points to an object of type <code>int</code></li></ul> <p>This is usually stated more succinctly as "<code>ptr</code> is a pointer to <code>int</code>." </p><p>Because the C language does not specify an implicit initialization for objects of automatic storage duration,<sup id="cite_ref-5" class="reference"><a href="#cite_note-5"><span class="cite-bracket">&#91;</span>5<span class="cite-bracket">&#93;</span></a></sup> care should often be taken to ensure that the address to which <code>ptr</code> points is valid; this is why it is sometimes suggested that a pointer be explicitly initialized to the <a href="/wiki/Null_pointer" title="Null pointer">null pointer</a> value, which is traditionally specified in C with the standardized macro <code>NULL</code>:<sup id="cite_ref-c-NULL_6-0" class="reference"><a href="#cite_note-c-NULL-6"><span class="cite-bracket">&#91;</span>6<span class="cite-bracket">&#93;</span></a></sup> </p> <div class="mw-highlight mw-highlight-lang-c mw-content-ltr" dir="ltr"><pre><span></span><span class="kt">int</span><span class="w"> </span><span class="o">*</span><span class="n">ptr</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nb">NULL</span><span class="p">;</span> </pre></div> <p>Dereferencing a null pointer in C produces <a href="/wiki/Undefined_behavior" title="Undefined behavior">undefined behavior</a>,<sup id="cite_ref-7" class="reference"><a href="#cite_note-7"><span class="cite-bracket">&#91;</span>7<span class="cite-bracket">&#93;</span></a></sup> which could be catastrophic. However, most implementations<sup class="noprint Inline-Template Template-Fact" style="white-space:nowrap;">&#91;<i><a href="/wiki/Wikipedia:Citation_needed" title="Wikipedia:Citation needed"><span title="This claim needs references to reliable sources. (July 2011)">citation needed</span></a></i>&#93;</sup> simply halt execution of the program in question, usually with a <a href="/wiki/Segmentation_fault" title="Segmentation fault">segmentation fault</a>. </p><p>However, initializing pointers unnecessarily could hinder program analysis, thereby hiding bugs. </p><p>In any case, once a pointer has been declared, the next logical step is for it to point at something: </p> <div class="mw-highlight mw-highlight-lang-c mw-content-ltr" dir="ltr"><pre><span></span><span class="kt">int</span><span class="w"> </span><span class="n">a</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">5</span><span class="p">;</span> <span class="kt">int</span><span class="w"> </span><span class="o">*</span><span class="n">ptr</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nb">NULL</span><span class="p">;</span> <span class="n">ptr</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="o">&amp;</span><span class="n">a</span><span class="p">;</span> </pre></div> <p>This assigns the value of the address of <code>a</code> to <code>ptr</code>. For example, if <code>a</code> is stored at memory location of 0x8130 then the value of <code>ptr</code> will be 0x8130 after the assignment. To dereference the pointer, an asterisk is used again: </p> <div class="mw-highlight mw-highlight-lang-c mw-content-ltr" dir="ltr"><pre><span></span><span class="o">*</span><span class="n">ptr</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">8</span><span class="p">;</span> </pre></div> <p>This means take the contents of <code>ptr</code> (which is 0x8130), "locate" that address in memory and set its value to 8. If <code>a</code> is later accessed again, its new value will be 8. </p><p>This example may be clearer if memory is examined directly. Assume that <code>a</code> is located at address 0x8130 in memory and <code>ptr</code> at 0x8134; also assume this is a 32-bit machine such that an int is 32-bits wide. The following is what would be in memory after the following code snippet is executed: </p> <div class="mw-highlight mw-highlight-lang-c mw-content-ltr" dir="ltr"><pre><span></span><span class="kt">int</span><span class="w"> </span><span class="n">a</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">5</span><span class="p">;</span> <span class="kt">int</span><span class="w"> </span><span class="o">*</span><span class="n">ptr</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nb">NULL</span><span class="p">;</span> </pre></div> <table class="wikitable" style="padding-left: 2em;"> <tbody><tr> <th>Address</th> <th>Contents </th></tr> <tr> <td><b>0x8130</b></td> <td>0x00000005 </td></tr> <tr> <td><b>0x8134</b></td> <td>0x00000000 </td></tr></tbody></table> <p>(The NULL pointer shown here is 0x00000000.) By assigning the address of <code>a</code> to <code>ptr</code>: </p> <div class="mw-highlight mw-highlight-lang-c mw-content-ltr" dir="ltr"><pre><span></span><span class="n">ptr</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="o">&amp;</span><span class="n">a</span><span class="p">;</span> </pre></div> <p>yields the following memory values: </p> <table class="wikitable" style="padding-left: 2em;"> <tbody><tr> <th>Address</th> <th>Contents </th></tr> <tr> <td><b>0x8130</b></td> <td>0x00000005 </td></tr> <tr> <td><b>0x8134</b></td> <td>0x00008130 </td></tr></tbody></table> <p>Then by dereferencing <code>ptr</code> by coding: </p> <div class="mw-highlight mw-highlight-lang-c mw-content-ltr" dir="ltr"><pre><span></span><span class="o">*</span><span class="n">ptr</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">8</span><span class="p">;</span> </pre></div> <p>the computer will take the contents of <code>ptr</code> (which is 0x8130), 'locate' that address, and assign 8 to that location yielding the following memory: </p> <table class="wikitable" style="padding-left: 2em;"> <tbody><tr> <th>Address</th> <th>Contents </th></tr> <tr> <td><b>0x8130</b></td> <td>0x00000008 </td></tr> <tr> <td><b>0x8134</b></td> <td>0x00008130 </td></tr></tbody></table> <p>Clearly, accessing <code>a</code> will yield the value of 8 because the previous instruction modified the contents of <code>a</code> by way of the pointer <code>ptr</code>. </p> <div class="mw-heading mw-heading3"><h3 id="Use_in_data_structures">Use in data structures</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Pointer_(computer_programming)&amp;action=edit&amp;section=6" title="Edit section: Use in data structures"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>When setting up <a href="/wiki/Data_structure" title="Data structure">data structures</a> like <a href="/wiki/List_(computing)" class="mw-redirect" title="List (computing)">lists</a>, <a href="/wiki/Queue_(abstract_data_type)" title="Queue (abstract data type)">queues</a> and trees, it is necessary to have pointers to help manage how the structure is implemented and controlled. Typical examples of pointers are start pointers, end pointers, and <a href="/wiki/Stack_(abstract_data_type)" title="Stack (abstract data type)">stack</a> pointers. These pointers can either be <b>absolute</b> (the actual <a href="/wiki/Physical_address" title="Physical address">physical address</a> or a <a href="/wiki/Virtual_address" class="mw-redirect" title="Virtual address">virtual address</a> in <a href="/wiki/Virtual_memory" title="Virtual memory">virtual memory</a>) or <b>relative</b> (an <a href="/wiki/Offset_(computer_science)" title="Offset (computer science)">offset</a> from an absolute start address ("base") that typically uses fewer bits than a full address, but will usually require one additional arithmetic operation to resolve). </p><p>Relative addresses are a form of manual <a href="/wiki/Memory_segmentation" title="Memory segmentation">memory segmentation</a>, and share many of its advantages and disadvantages. A two-byte offset, containing a 16-bit, unsigned integer, can be used to provide relative addressing for up to 64 <a href="/wiki/Kibibytes" class="mw-redirect" title="Kibibytes">KiB</a> (2<sup>16</sup> bytes) of a data structure. This can easily be extended to 128, 256 or 512 KiB if the address pointed to is forced to be <a href="/wiki/Data_structure_alignment" title="Data structure alignment">aligned</a> on a half-word, word or double-word boundary (but, requiring an additional "shift left" <a href="/wiki/Bitwise_operation" title="Bitwise operation">bitwise operation</a>—by 1, 2 or 3 bits—in order to adjust the offset by a factor of 2, 4 or 8, before its addition to the base address). Generally, though, such schemes are a lot of trouble, and for convenience to the programmer absolute addresses (and underlying that, a <i><a href="/wiki/Flat_address_space" class="mw-redirect" title="Flat address space">flat address space</a></i>) is preferred. </p><p>A one byte offset, such as the hexadecimal <a href="/wiki/ASCII" title="ASCII">ASCII</a> value of a character (e.g. X'29') can be used to point to an alternative integer value (or index) in an array (e.g., X'01'). In this way, characters can be very efficiently translated from '<a href="/wiki/Raw_data" title="Raw data">raw data</a>' to a usable sequential <a href="/wiki/Array_data_structure" class="mw-redirect" title="Array data structure">index</a> and then to an absolute address without a <a href="/wiki/Lookup_table" title="Lookup table">lookup table</a>. </p> <div class="mw-heading mw-heading4"><h4 id="C_arrays">C arrays</h4><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Pointer_(computer_programming)&amp;action=edit&amp;section=7" title="Edit section: C arrays"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>In C, array indexing is formally defined in terms of pointer arithmetic; that is, the language specification requires that <code>array[i]</code> be equivalent to <code>*(array + i)</code>.<sup id="cite_ref-Plauger1992_8-0" class="reference"><a href="#cite_note-Plauger1992-8"><span class="cite-bracket">&#91;</span>8<span class="cite-bracket">&#93;</span></a></sup> Thus in C, arrays can be thought of as pointers to consecutive areas of memory (with no gaps),<sup id="cite_ref-Plauger1992_8-1" class="reference"><a href="#cite_note-Plauger1992-8"><span class="cite-bracket">&#91;</span>8<span class="cite-bracket">&#93;</span></a></sup> and the syntax for accessing arrays is identical for that which can be used to dereference pointers. For example, an array <code>array</code> can be declared and used in the following manner: </p> <div class="mw-highlight mw-highlight-lang-c mw-content-ltr" dir="ltr"><pre><span></span><span class="kt">int</span><span class="w"> </span><span class="n">array</span><span class="p">[</span><span class="mi">5</span><span class="p">];</span><span class="w"> </span><span class="cm">/* Declares 5 contiguous integers */</span> <span class="kt">int</span><span class="w"> </span><span class="o">*</span><span class="n">ptr</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">array</span><span class="p">;</span><span class="w"> </span><span class="cm">/* Arrays can be used as pointers */</span> <span class="n">ptr</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">1</span><span class="p">;</span><span class="w"> </span><span class="cm">/* Pointers can be indexed with array syntax */</span> <span class="o">*</span><span class="p">(</span><span class="n">array</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="mi">1</span><span class="p">)</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">2</span><span class="p">;</span><span class="w"> </span><span class="cm">/* Arrays can be dereferenced with pointer syntax */</span> <span class="o">*</span><span class="p">(</span><span class="mi">1</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="n">array</span><span class="p">)</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">2</span><span class="p">;</span><span class="w"> </span><span class="cm">/* Pointer addition is commutative */</span> <span class="mi">2</span><span class="p">[</span><span class="n">array</span><span class="p">]</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">4</span><span class="p">;</span><span class="w"> </span><span class="cm">/* Subscript operator is commutative */</span> </pre></div> <p>This allocates a block of five integers and names the block <code>array</code>, which acts as a pointer to the block. Another common use of pointers is to point to dynamically allocated memory from <a href="/wiki/Malloc" class="mw-redirect" title="Malloc">malloc</a> which returns a consecutive block of memory of no less than the requested size that can be used as an array. </p><p>While most operators on arrays and pointers are equivalent, the result of the <code><a href="/wiki/Sizeof#Using_sizeof_with_arrays" title="Sizeof">sizeof</a></code> operator differs. In this example, <code>sizeof(array)</code> will evaluate to <code>5*sizeof(int)</code> (the size of the array), while <code>sizeof(ptr)</code> will evaluate to <code>sizeof(int*)</code>, the size of the pointer itself. </p><p>Default values of an array can be declared like: </p> <div class="mw-highlight mw-highlight-lang-c mw-content-ltr" dir="ltr"><pre><span></span><span class="kt">int</span><span class="w"> </span><span class="n">array</span><span class="p">[</span><span class="mi">5</span><span class="p">]</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">{</span><span class="mi">2</span><span class="p">,</span><span class="w"> </span><span class="mi">4</span><span class="p">,</span><span class="w"> </span><span class="mi">3</span><span class="p">,</span><span class="w"> </span><span class="mi">1</span><span class="p">,</span><span class="w"> </span><span class="mi">5</span><span class="p">};</span> </pre></div> <p>If <code>array</code> is located in memory starting at address 0x1000 on a 32-bit <a href="/wiki/Endianness#Little-endian" title="Endianness">little-endian</a> machine then memory will contain the following (values are in <a href="/wiki/Hexadecimal" title="Hexadecimal">hexadecimal</a>, like the addresses): </p> <dl><dd><table class="wikitable" style="font-family:monospace;"> <tbody><tr> <td> </td> <th>0</th> <th>1</th> <th>2</th> <th>3 </th></tr> <tr> <th>1000 </th> <td>2</td> <td>0</td> <td>0</td> <td>0 </td></tr> <tr> <th>1004 </th> <td>4</td> <td>0</td> <td>0</td> <td>0 </td></tr> <tr> <th>1008 </th> <td>3</td> <td>0</td> <td>0</td> <td>0 </td></tr> <tr> <th>100C </th> <td>1</td> <td>0</td> <td>0</td> <td>0 </td></tr> <tr> <th>1010 </th> <td>5</td> <td>0</td> <td>0</td> <td>0 </td></tr></tbody></table></dd></dl> <p>Represented here are five integers: 2, 4, 3, 1, and 5. These five integers occupy 32 bits (4 bytes) each with the least-significant byte stored first (this is a little-endian <a href="/wiki/CPU_architecture" class="mw-redirect" title="CPU architecture">CPU architecture</a>) and are stored consecutively starting at address 0x1000. </p><p>The syntax for C with pointers is: </p> <ul><li><code>array</code> means 0x1000;</li> <li><code>array + 1</code> means 0x1004: the "+ 1" means to add the size of 1 <code>int</code>, which is 4 bytes;</li> <li><code>*array</code> means to dereference the contents of <code>array</code>. Considering the contents as a memory address (0x1000), look up the value at that location (0x0002);</li> <li><code>array[i]</code> means element number <code>i</code>, 0-based, of <code>array</code> which is translated into <code>*(array + i)</code>.</li></ul> <p>The last example is how to access the contents of <code>array</code>. Breaking it down: </p> <ul><li><code>array + i</code> is the memory location of the (i)<sup>th</sup> element of <code>array</code>, starting at i=0;</li> <li><code>*(array + i)</code> takes that memory address and dereferences it to access the value.</li></ul> <div class="mw-heading mw-heading4"><h4 id="C_linked_list">C linked list</h4><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Pointer_(computer_programming)&amp;action=edit&amp;section=8" title="Edit section: C linked list"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>Below is an example definition of a <a href="/wiki/Linked_list" title="Linked list">linked list</a> in C. </p> <div class="mw-highlight mw-highlight-lang-c mw-content-ltr" dir="ltr"><pre><span></span><span class="cm">/* the empty linked list is represented by NULL</span> <span class="cm"> * or some other sentinel value */</span> <span class="cp">#define EMPTY_LIST NULL</span> <span class="k">struct</span><span class="w"> </span><span class="nc">link</span><span class="w"> </span><span class="p">{</span> <span class="w"> </span><span class="kt">void</span><span class="w"> </span><span class="o">*</span><span class="n">data</span><span class="p">;</span><span class="w"> </span><span class="cm">/* data of this link */</span> <span class="w"> </span><span class="k">struct</span><span class="w"> </span><span class="nc">link</span><span class="w"> </span><span class="o">*</span><span class="n">next</span><span class="p">;</span><span class="w"> </span><span class="cm">/* next link; EMPTY_LIST if there is none */</span> <span class="p">};</span> </pre></div> <p>This pointer-recursive definition is essentially the same as the reference-recursive definition from the language <a href="/wiki/Haskell" title="Haskell">Haskell</a>: </p> <div class="mw-highlight mw-highlight-lang-haskell mw-content-ltr" dir="ltr"><pre><span></span><span class="w"> </span><span class="kr">data</span><span class="w"> </span><span class="kt">Link</span><span class="w"> </span><span class="n">a</span><span class="w"> </span><span class="ow">=</span><span class="w"> </span><span class="kt">Nil</span> <span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="kt">Cons</span><span class="w"> </span><span class="n">a</span><span class="w"> </span><span class="p">(</span><span class="kt">Link</span><span class="w"> </span><span class="n">a</span><span class="p">)</span> </pre></div> <p><code>Nil</code> is the empty list, and <code>Cons a (Link a)</code> is a <a href="/wiki/Cons" title="Cons">cons</a> cell of type <code>a</code> with another link also of type <code>a</code>. </p><p>The definition with references, however, is type-checked and does not use potentially confusing signal values. For this reason, data structures in C are usually dealt with via <a href="/wiki/Wrapper_function" title="Wrapper function">wrapper functions</a>, which are carefully checked for correctness. </p> <div class="mw-heading mw-heading3"><h3 id="Pass-by-address_using_pointers">Pass-by-address using pointers</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Pointer_(computer_programming)&amp;action=edit&amp;section=9" title="Edit section: Pass-by-address using pointers"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>Pointers can be used to pass variables by their address, allowing their value to be changed. For example, consider the following <a href="/wiki/C_(programming_language)" title="C (programming language)">C</a> code: </p> <div class="mw-highlight mw-highlight-lang-c mw-content-ltr" dir="ltr"><pre><span></span><span class="cm">/* a copy of the int n can be changed within the function without affecting the calling code */</span> <span class="kt">void</span><span class="w"> </span><span class="nf">passByValue</span><span class="p">(</span><span class="kt">int</span><span class="w"> </span><span class="n">n</span><span class="p">)</span><span class="w"> </span><span class="p">{</span> <span class="w"> </span><span class="n">n</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">12</span><span class="p">;</span> <span class="p">}</span> <span class="cm">/* a pointer m is passed instead. No copy of the value pointed to by m is created */</span> <span class="kt">void</span><span class="w"> </span><span class="nf">passByAddress</span><span class="p">(</span><span class="kt">int</span><span class="w"> </span><span class="o">*</span><span class="n">m</span><span class="p">)</span><span class="w"> </span><span class="p">{</span> <span class="w"> </span><span class="o">*</span><span class="n">m</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">14</span><span class="p">;</span> <span class="p">}</span> <span class="kt">int</span><span class="w"> </span><span class="nf">main</span><span class="p">(</span><span class="kt">void</span><span class="p">)</span><span class="w"> </span><span class="p">{</span> <span class="w"> </span><span class="kt">int</span><span class="w"> </span><span class="n">x</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">3</span><span class="p">;</span> <span class="w"> </span><span class="cm">/* pass a copy of x&#39;s value as the argument */</span> <span class="w"> </span><span class="n">passByValue</span><span class="p">(</span><span class="n">x</span><span class="p">);</span> <span class="w"> </span><span class="c1">// the value was changed inside the function, but x is still 3 from here on</span> <span class="w"> </span><span class="cm">/* pass x&#39;s address as the argument */</span> <span class="w"> </span><span class="n">passByAddress</span><span class="p">(</span><span class="o">&amp;</span><span class="n">x</span><span class="p">);</span> <span class="w"> </span><span class="c1">// x was actually changed by the function and is now equal to 14 here</span> <span class="w"> </span><span class="k">return</span><span class="w"> </span><span class="mi">0</span><span class="p">;</span> <span class="p">}</span> </pre></div> <div class="mw-heading mw-heading3"><h3 id="Dynamic_memory_allocation">Dynamic memory allocation</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Pointer_(computer_programming)&amp;action=edit&amp;section=10" title="Edit section: Dynamic memory allocation"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>In some programs, the required amount of memory depends on what <i>the user</i> may enter. In such cases the programmer needs to allocate memory dynamically. This is done by allocating memory at the <i>heap</i> rather than on the <i>stack</i>, where variables usually are stored (although variables can also be stored in the CPU registers). Dynamic memory allocation can only be made through pointers, and names &#8211; like with common variables &#8211; cannot be given. </p><p>Pointers are used to store and manage the addresses of <a href="/wiki/Dynamic_memory_allocation" class="mw-redirect" title="Dynamic memory allocation">dynamically allocated</a> blocks of memory. Such blocks are used to store data objects or arrays of objects. Most structured and object-oriented languages provide an area of memory, called the <i>heap</i> or <i>free store</i>, from which objects are dynamically allocated. </p><p>The example C code below illustrates how structure objects are dynamically allocated and referenced. The <a href="/wiki/Standard_C_library" class="mw-redirect" title="Standard C library">standard C library</a> provides the function <a href="/wiki/Malloc" class="mw-redirect" title="Malloc"><code>malloc()</code></a> for allocating memory blocks from the heap. It takes the size of an object to allocate as a parameter and returns a pointer to a newly allocated block of memory suitable for storing the object, or it returns a null pointer if the allocation failed. </p> <div class="mw-highlight mw-highlight-lang-c mw-content-ltr" dir="ltr"><pre><span></span><span class="cm">/* Parts inventory item */</span> <span class="k">struct</span><span class="w"> </span><span class="nc">Item</span><span class="w"> </span><span class="p">{</span> <span class="w"> </span><span class="kt">int</span><span class="w"> </span><span class="n">id</span><span class="p">;</span><span class="w"> </span><span class="cm">/* Part number */</span> <span class="w"> </span><span class="kt">char</span><span class="w"> </span><span class="o">*</span><span class="w"> </span><span class="n">name</span><span class="p">;</span><span class="w"> </span><span class="cm">/* Part name */</span> <span class="w"> </span><span class="kt">float</span><span class="w"> </span><span class="n">cost</span><span class="p">;</span><span class="w"> </span><span class="cm">/* Cost */</span> <span class="p">};</span> <span class="cm">/* Allocate and initialize a new Item object */</span> <span class="k">struct</span><span class="w"> </span><span class="nc">Item</span><span class="w"> </span><span class="o">*</span><span class="w"> </span><span class="n">make_item</span><span class="p">(</span><span class="k">const</span><span class="w"> </span><span class="kt">char</span><span class="w"> </span><span class="o">*</span><span class="n">name</span><span class="p">)</span><span class="w"> </span><span class="p">{</span> <span class="w"> </span><span class="k">struct</span><span class="w"> </span><span class="nc">Item</span><span class="w"> </span><span class="o">*</span><span class="w"> </span><span class="n">item</span><span class="p">;</span> <span class="w"> </span><span class="cm">/* Allocate a block of memory for a new Item object */</span> <span class="w"> </span><span class="n">item</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">malloc</span><span class="p">(</span><span class="k">sizeof</span><span class="p">(</span><span class="k">struct</span><span class="w"> </span><span class="nc">Item</span><span class="p">));</span> <span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="p">(</span><span class="n">item</span><span class="w"> </span><span class="o">==</span><span class="w"> </span><span class="nb">NULL</span><span class="p">)</span> <span class="w"> </span><span class="k">return</span><span class="w"> </span><span class="nb">NULL</span><span class="p">;</span> <span class="w"> </span><span class="cm">/* Initialize the members of the new Item */</span> <span class="w"> </span><span class="n">memset</span><span class="p">(</span><span class="n">item</span><span class="p">,</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w"> </span><span class="k">sizeof</span><span class="p">(</span><span class="k">struct</span><span class="w"> </span><span class="nc">Item</span><span class="p">));</span> <span class="w"> </span><span class="n">item</span><span class="o">-&gt;</span><span class="n">id</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">-1</span><span class="p">;</span> <span class="w"> </span><span class="n">item</span><span class="o">-&gt;</span><span class="n">name</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nb">NULL</span><span class="p">;</span> <span class="w"> </span><span class="n">item</span><span class="o">-&gt;</span><span class="n">cost</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mf">0.0</span><span class="p">;</span> <span class="w"> </span><span class="cm">/* Save a copy of the name in the new Item */</span> <span class="w"> </span><span class="n">item</span><span class="o">-&gt;</span><span class="n">name</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">malloc</span><span class="p">(</span><span class="n">strlen</span><span class="p">(</span><span class="n">name</span><span class="p">)</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="mi">1</span><span class="p">);</span> <span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="p">(</span><span class="n">item</span><span class="o">-&gt;</span><span class="n">name</span><span class="w"> </span><span class="o">==</span><span class="w"> </span><span class="nb">NULL</span><span class="p">)</span><span class="w"> </span><span class="p">{</span> <span class="w"> </span><span class="n">free</span><span class="p">(</span><span class="n">item</span><span class="p">);</span> <span class="w"> </span><span class="k">return</span><span class="w"> </span><span class="nb">NULL</span><span class="p">;</span> <span class="w"> </span><span class="p">}</span> <span class="w"> </span><span class="n">strcpy</span><span class="p">(</span><span class="n">item</span><span class="o">-&gt;</span><span class="n">name</span><span class="p">,</span><span class="w"> </span><span class="n">name</span><span class="p">);</span> <span class="w"> </span><span class="cm">/* Return the newly created Item object */</span> <span class="w"> </span><span class="k">return</span><span class="w"> </span><span class="n">item</span><span class="p">;</span> <span class="p">}</span> </pre></div> <p>The code below illustrates how memory objects are dynamically deallocated, i.e., returned to the heap or free store. The standard C library provides the function <a href="/wiki/Free()" class="mw-redirect" title="Free()"><code>free()</code></a> for deallocating a previously allocated memory block and returning it back to the heap. </p> <div class="mw-highlight mw-highlight-lang-c mw-content-ltr" dir="ltr"><pre><span></span><span class="cm">/* Deallocate an Item object */</span> <span class="kt">void</span><span class="w"> </span><span class="nf">destroy_item</span><span class="p">(</span><span class="k">struct</span><span class="w"> </span><span class="nc">Item</span><span class="w"> </span><span class="o">*</span><span class="n">item</span><span class="p">)</span><span class="w"> </span><span class="p">{</span> <span class="w"> </span><span class="cm">/* Check for a null object pointer */</span> <span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="p">(</span><span class="n">item</span><span class="w"> </span><span class="o">==</span><span class="w"> </span><span class="nb">NULL</span><span class="p">)</span> <span class="w"> </span><span class="k">return</span><span class="p">;</span> <span class="w"> </span><span class="cm">/* Deallocate the name string saved within the Item */</span> <span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="p">(</span><span class="n">item</span><span class="o">-&gt;</span><span class="n">name</span><span class="w"> </span><span class="o">!=</span><span class="w"> </span><span class="nb">NULL</span><span class="p">)</span><span class="w"> </span><span class="p">{</span> <span class="w"> </span><span class="n">free</span><span class="p">(</span><span class="n">item</span><span class="o">-&gt;</span><span class="n">name</span><span class="p">);</span> <span class="w"> </span><span class="n">item</span><span class="o">-&gt;</span><span class="n">name</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nb">NULL</span><span class="p">;</span> <span class="w"> </span><span class="p">}</span> <span class="w"> </span><span class="cm">/* Deallocate the Item object itself */</span> <span class="w"> </span><span class="n">free</span><span class="p">(</span><span class="n">item</span><span class="p">);</span> <span class="p">}</span> </pre></div> <div class="mw-heading mw-heading3"><h3 id="Memory-mapped_hardware">Memory-mapped hardware</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Pointer_(computer_programming)&amp;action=edit&amp;section=11" title="Edit section: Memory-mapped hardware"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>On some computing architectures, pointers can be used to directly manipulate memory or memory-mapped devices. </p><p>Assigning addresses to pointers is an invaluable tool when programming <a href="/wiki/Microcontroller" title="Microcontroller">microcontrollers</a>. Below is a simple example declaring a pointer of type int and initialising it to a <a href="/wiki/Hexadecimal" title="Hexadecimal">hexadecimal</a> address in this example the constant 0x7FFF: </p> <div class="mw-highlight mw-highlight-lang-c mw-content-ltr" dir="ltr"><pre><span></span><span class="kt">int</span><span class="w"> </span><span class="o">*</span><span class="n">hardware_address</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">(</span><span class="kt">int</span><span class="w"> </span><span class="o">*</span><span class="p">)</span><span class="mh">0x7FFF</span><span class="p">;</span> </pre></div> <p>In the mid 80s, using the <a href="/wiki/BIOS" title="BIOS">BIOS</a> to access the video capabilities of PCs was slow. Applications that were display-intensive typically used to access <a href="/wiki/Color_Graphics_Adapter" title="Color Graphics Adapter">CGA</a> video memory directly by casting the <a href="/wiki/Hexadecimal" title="Hexadecimal">hexadecimal</a> constant 0xB8000 to a pointer to an array of 80 unsigned 16-bit int values. Each value consisted of an <a href="/wiki/ASCII" title="ASCII">ASCII</a> code in the low byte, and a colour in the high byte. Thus, to put the letter 'A' at row 5, column 2 in bright white on blue, one would write code like the following: </p> <div class="mw-highlight mw-highlight-lang-c mw-content-ltr" dir="ltr"><pre><span></span><span class="cp">#define VID ((unsigned short (*)[80])0xB8000)</span> <span class="kt">void</span><span class="w"> </span><span class="nf">foo</span><span class="p">(</span><span class="kt">void</span><span class="p">)</span><span class="w"> </span><span class="p">{</span> <span class="w"> </span><span class="n">VID</span><span class="p">[</span><span class="mi">4</span><span class="p">][</span><span class="mi">1</span><span class="p">]</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mh">0x1F00</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="sc">&#39;A&#39;</span><span class="p">;</span> <span class="p">}</span> </pre></div> <div class="mw-heading mw-heading3"><h3 id="Use_in_control_tables">Use in control tables</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Pointer_(computer_programming)&amp;action=edit&amp;section=12" title="Edit section: Use in control tables"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p><a href="/wiki/Control_table" title="Control table">Control tables</a> that are used to control <a href="/wiki/Program_flow" class="mw-redirect" title="Program flow">program flow</a> usually make extensive use of pointers. The pointers, usually embedded in a table entry, may, for instance, be used to hold the entry points to <a href="/wiki/Subroutine" class="mw-redirect" title="Subroutine">subroutines</a> to be executed, based on certain conditions defined in the same table entry. The pointers can however be simply indexes to other separate, but associated, tables comprising an array of the actual addresses or the addresses themselves (depending upon the programming language constructs available). They can also be used to point to earlier table entries (as in loop processing) or forward to skip some table entries (as in a <a href="/wiki/Switch_statement" title="Switch statement">switch</a> or "early" exit from a loop). For this latter purpose, the "pointer" may simply be the table entry number itself and can be transformed into an actual address by simple arithmetic. </p> <div class="mw-heading mw-heading2"><h2 id="Typed_pointers_and_casting">Typed pointers and casting</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Pointer_(computer_programming)&amp;action=edit&amp;section=13" title="Edit section: Typed pointers and casting"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>In many languages, pointers have the additional restriction that the object they point to has a specific <a href="/wiki/Datatype" class="mw-redirect" title="Datatype">type</a>. For example, a pointer may be declared to point to an <a href="/wiki/Integer" title="Integer">integer</a>; the language will then attempt to prevent the programmer from pointing it to objects which are not integers, such as <a href="/wiki/Floating-point_number" class="mw-redirect" title="Floating-point number">floating-point numbers</a>, eliminating some errors. </p><p>For example, in C </p> <div class="mw-highlight mw-highlight-lang-c mw-content-ltr" dir="ltr"><pre><span></span><span class="kt">int</span><span class="w"> </span><span class="o">*</span><span class="n">money</span><span class="p">;</span> <span class="kt">char</span><span class="w"> </span><span class="o">*</span><span class="n">bags</span><span class="p">;</span> </pre></div> <p><code>money</code> would be an integer pointer and <code>bags</code> would be a char pointer. The following would yield a compiler warning of "assignment from incompatible pointer type" under <a href="/wiki/GNU_Compiler_Collection" title="GNU Compiler Collection">GCC</a> </p> <div class="mw-highlight mw-highlight-lang-c mw-content-ltr" dir="ltr"><pre><span></span><span class="n">bags</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">money</span><span class="p">;</span> </pre></div> <p>because <code>money</code> and <code>bags</code> were declared with different types. To suppress the compiler warning, it must be made explicit that you do indeed wish to make the assignment by <a href="/wiki/Type_conversion" title="Type conversion">typecasting</a> it </p> <div class="mw-highlight mw-highlight-lang-c mw-content-ltr" dir="ltr"><pre><span></span><span class="n">bags</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">(</span><span class="kt">char</span><span class="w"> </span><span class="o">*</span><span class="p">)</span><span class="n">money</span><span class="p">;</span> </pre></div> <p>which says to cast the integer pointer of <code>money</code> to a char pointer and assign to <code>bags</code>. </p><p>A 2005 draft of the C standard requires that casting a pointer derived from one type to one of another type should maintain the alignment correctness for both types (6.3.2.3 Pointers, par. 7):<sup id="cite_ref-9" class="reference"><a href="#cite_note-9"><span class="cite-bracket">&#91;</span>9<span class="cite-bracket">&#93;</span></a></sup> </p> <div class="mw-highlight mw-highlight-lang-c mw-content-ltr" dir="ltr"><pre><span></span><span class="kt">char</span><span class="w"> </span><span class="o">*</span><span class="n">external_buffer</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">&quot;abcdef&quot;</span><span class="p">;</span> <span class="kt">int</span><span class="w"> </span><span class="o">*</span><span class="n">internal_data</span><span class="p">;</span> <span class="n">internal_data</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">(</span><span class="kt">int</span><span class="w"> </span><span class="o">*</span><span class="p">)</span><span class="n">external_buffer</span><span class="p">;</span><span class="w"> </span><span class="c1">// UNDEFINED BEHAVIOUR if &quot;the resulting pointer</span> <span class="w"> </span><span class="c1">// is not correctly aligned&quot;</span> </pre></div> <p>In languages that allow pointer arithmetic, arithmetic on pointers takes into account the size of the type. For example, adding an integer number to a pointer produces another pointer that points to an address that is higher by that number times the size of the type. This allows us to easily compute the address of elements of an array of a given type, as was shown in the C arrays example above. When a pointer of one type is cast to another type of a different size, the programmer should expect that pointer arithmetic will be calculated differently. In C, for example, if the <code>money</code> array starts at 0x2000 and <code>sizeof(int)</code> is 4 bytes whereas <code>sizeof(char)</code> is 1 byte, then <code>money + 1</code> will point to 0x2004, but <code>bags + 1</code> would point to 0x2001. Other risks of casting include loss of data when "wide" data is written to "narrow" locations (e.g. <code>bags[0] = 65537;</code>), unexpected results when <a href="/wiki/Bit_shift" class="mw-redirect" title="Bit shift">bit-shifting</a> values, and comparison problems, especially with signed vs unsigned values. </p><p>Although it is impossible in general to determine at compile-time which casts are safe, some languages store <a href="/wiki/Run-time_type_information" title="Run-time type information">run-time type information</a> which can be used to confirm that these dangerous casts are valid at runtime. Other languages merely accept a conservative approximation of safe casts, or none at all. </p> <div class="mw-heading mw-heading3"><h3 id="Value_of_pointers">Value of pointers</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Pointer_(computer_programming)&amp;action=edit&amp;section=14" title="Edit section: Value of pointers"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>In C and C++, even if two pointers compare as equal that doesn't mean they are equivalent. In these languages <i>and</i> <a href="/wiki/LLVM" title="LLVM">LLVM</a>, the rule is interpreted to mean that "just because two pointers point to the same address, does not mean they are equal in the sense that they can be used interchangeably", the difference between the pointers referred to as their <i>provenance</i>.<sup id="cite_ref-10" class="reference"><a href="#cite_note-10"><span class="cite-bracket">&#91;</span>10<span class="cite-bracket">&#93;</span></a></sup> Casting to an integer type such as <code>uintptr_t</code> is implementation-defined and the comparison it provides does not provide any more insight as to whether the two pointers are interchangeable. In addition, further conversion to bytes and arithmetic will throw off optimizers trying to keep track the use of pointers, a problem still being elucidated in academic research.<sup id="cite_ref-11" class="reference"><a href="#cite_note-11"><span class="cite-bracket">&#91;</span>11<span class="cite-bracket">&#93;</span></a></sup> </p> <div class="mw-heading mw-heading2"><h2 id="Making_pointers_safer">Making pointers safer</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Pointer_(computer_programming)&amp;action=edit&amp;section=15" title="Edit section: Making pointers safer"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>As a pointer allows a program to attempt to access an object that may not be defined, pointers can be the origin of a variety of <a href="/wiki/Software_bug" title="Software bug">programming errors</a>. However, the usefulness of pointers is so great that it can be difficult to perform programming tasks without them. Consequently, many languages have created constructs designed to provide some of the useful features of pointers without some of their <a href="/wiki/Anti-pattern" title="Anti-pattern">pitfalls</a>, also sometimes referred to as <i>pointer hazards</i>. In this context, pointers that directly address memory (as used in this article) are referred to as <b><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238216509" /><span class="vanchor"><span id="raw_pointer"></span><span class="vanchor-text">raw pointer</span></span>s</b>, by contrast with <a href="/wiki/Smart_pointer" title="Smart pointer">smart pointers</a> or other variants. </p><p>One major problem with pointers is that as long as they can be directly manipulated as a number, they can be made to point to unused addresses or to data which is being used for other purposes. Many languages, including most functional programming languages and recent <a href="/wiki/Imperative_programming" title="Imperative programming">imperative programming</a> languages like <a href="/wiki/Java_(programming_language)" title="Java (programming language)">Java</a>, replace pointers with a more opaque type of reference, typically referred to as simply a <i>reference</i>, which can only be used to refer to objects and not manipulated as numbers, preventing this type of error. Array indexing is handled as a special case. </p><p>A pointer which does not have any address assigned to it is called a <a href="/wiki/Wild_pointer" class="mw-redirect" title="Wild pointer">wild pointer</a>. Any attempt to use such uninitialized pointers can cause unexpected behavior, either because the initial value is not a valid address, or because using it may damage other parts of the program. The result is often a <a href="/wiki/Segmentation_fault" title="Segmentation fault">segmentation fault</a>, <a href="/wiki/Storage_violation" title="Storage violation">storage violation</a> or <a href="/wiki/Wild_branch" title="Wild branch">wild branch</a> (if used as a function pointer or branch address). </p><p>In systems with explicit memory allocation, it is possible to create a <a href="/wiki/Dangling_pointer" title="Dangling pointer">dangling pointer</a> by deallocating the memory region it points into. This type of pointer is dangerous and subtle because a deallocated memory region may contain the same data as it did before it was deallocated but may be then reallocated and overwritten by unrelated code, unknown to the earlier code. Languages with <a href="/wiki/Garbage_collection_(computer_science)" title="Garbage collection (computer science)">garbage collection</a> prevent this type of error because deallocation is performed automatically when there are no more references in scope. </p><p>Some languages, like <a href="/wiki/C%2B%2B" title="C++">C++</a>, support <a href="/wiki/Smart_pointer" title="Smart pointer">smart pointers</a>, which use a simple form of <a href="/wiki/Reference_counting" title="Reference counting">reference counting</a> to help track allocation of dynamic memory in addition to acting as a reference. In the absence of reference cycles, where an object refers to itself indirectly through a sequence of smart pointers, these eliminate the possibility of dangling pointers and memory leaks. <a href="/wiki/Delphi_(programming_language)" class="mw-redirect" title="Delphi (programming language)">Delphi</a> strings support reference counting natively. </p><p>The <a href="/wiki/Rust_programming_language" class="mw-redirect" title="Rust programming language">Rust programming language</a> introduces a <i>borrow checker</i>, <i>pointer lifetimes</i>, and an optimisation based around <a href="/wiki/Option_type" title="Option type">option types</a> for <a href="/wiki/Null_pointer" title="Null pointer">null pointers</a> to eliminate pointer bugs, without resorting to <a href="/wiki/Garbage_collection_(computer_science)" title="Garbage collection (computer science)">garbage collection</a>. </p> <div class="mw-heading mw-heading2"><h2 id="Special_kinds_of_pointers">Special kinds of pointers</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Pointer_(computer_programming)&amp;action=edit&amp;section=16" title="Edit section: Special kinds of pointers"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <div class="mw-heading mw-heading3"><h3 id="Kinds_defined_by_value">Kinds defined by value</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Pointer_(computer_programming)&amp;action=edit&amp;section=17" title="Edit section: Kinds defined by value"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <div class="mw-heading mw-heading4"><h4 id="Null_pointer">Null pointer</h4><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Pointer_(computer_programming)&amp;action=edit&amp;section=18" title="Edit section: Null pointer"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1236090951" /><div role="note" class="hatnote navigation-not-searchable">Main article: <a href="/wiki/Null_pointer" title="Null pointer">Null pointer</a></div> <p>A <b>null pointer</b> has a value reserved for indicating that the pointer does not refer to a valid object. Null pointers are routinely used to represent conditions such as the end of a <a href="/wiki/List_(computing)" class="mw-redirect" title="List (computing)">list</a> of unknown length or the failure to perform some action; this use of null pointers can be compared to <a href="/wiki/Nullable_type" title="Nullable type">nullable types</a> and to the <i>Nothing</i> value in an <a href="/wiki/Option_type" title="Option type">option type</a>. </p> <div class="mw-heading mw-heading4"><h4 id="Dangling_pointer">Dangling pointer</h4><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Pointer_(computer_programming)&amp;action=edit&amp;section=19" title="Edit section: Dangling pointer"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1236090951" /><div role="note" class="hatnote navigation-not-searchable">Main article: <a href="/wiki/Dangling_pointer" title="Dangling pointer">Dangling pointer</a></div> <p>A <b>dangling pointer</b> is a pointer that does not point to a valid object and consequently may make a program crash or behave oddly. In the <a href="/wiki/Pascal_(programming_language)" title="Pascal (programming language)">Pascal</a> or <a href="/wiki/C_(programming_language)" title="C (programming language)">C programming languages</a>, pointers that are not specifically initialized may point to unpredictable addresses in memory. </p><p>The following example code shows a dangling pointer: </p> <div class="mw-highlight mw-highlight-lang-c mw-content-ltr" dir="ltr"><pre><span></span><span class="kt">int</span><span class="w"> </span><span class="nf">func</span><span class="p">(</span><span class="kt">void</span><span class="p">)</span><span class="w"> </span><span class="p">{</span> <span class="w"> </span><span class="kt">char</span><span class="w"> </span><span class="o">*</span><span class="n">p1</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">malloc</span><span class="p">(</span><span class="k">sizeof</span><span class="p">(</span><span class="kt">char</span><span class="p">));</span><span class="w"> </span><span class="cm">/* (undefined) value of some place on the heap */</span> <span class="w"> </span><span class="kt">char</span><span class="w"> </span><span class="o">*</span><span class="n">p2</span><span class="p">;</span><span class="w"> </span><span class="cm">/* dangling (uninitialized) pointer */</span> <span class="w"> </span><span class="o">*</span><span class="n">p1</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="sc">&#39;a&#39;</span><span class="p">;</span><span class="w"> </span><span class="cm">/* This is OK, assuming malloc() has not returned NULL. */</span> <span class="w"> </span><span class="o">*</span><span class="n">p2</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="sc">&#39;b&#39;</span><span class="p">;</span><span class="w"> </span><span class="cm">/* This invokes undefined behavior */</span> <span class="p">}</span> </pre></div> <p>Here, <code>p2</code> may point to anywhere in memory, so performing the assignment <code>*p2 = 'b';</code> can corrupt an unknown area of memory or trigger a <a href="/wiki/Segmentation_fault" title="Segmentation fault">segmentation fault</a>. </p> <div class="mw-heading mw-heading4"><h4 id="Wild_branch">Wild branch</h4><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Pointer_(computer_programming)&amp;action=edit&amp;section=20" title="Edit section: Wild branch"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>Where a pointer is used as the address of the entry point to a program or start of a <a href="/wiki/Subroutine" class="mw-redirect" title="Subroutine">function which doesn't return anything</a> and is also either uninitialized or corrupted, if a call or <a href="/wiki/Unconditional_branch" class="mw-redirect" title="Unconditional branch">jump</a> is nevertheless made to this address, a "<a href="/wiki/Wild_branch" title="Wild branch">wild branch</a>" is said to have occurred. In other words, a wild branch is a function pointer that is wild (dangling). </p><p>The consequences are usually unpredictable and the error may present itself in several different ways depending upon whether or not the pointer is a "valid" address and whether or not there is (coincidentally) a valid instruction (opcode) at that address. The detection of a wild branch can present one of the most difficult and frustrating debugging exercises since much of the evidence may already have been destroyed beforehand or by execution of one or more inappropriate instructions at the branch location. If available, an <a href="/wiki/Instruction_set_simulator" title="Instruction set simulator">instruction set simulator</a> can usually not only detect a wild branch before it takes effect, but also provide a complete or partial trace of its history. </p> <div class="mw-heading mw-heading3"><h3 id="Kinds_defined_by_structure">Kinds defined by structure</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Pointer_(computer_programming)&amp;action=edit&amp;section=21" title="Edit section: Kinds defined by structure"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <div class="mw-heading mw-heading4"><h4 id="Autorelative_pointer">Autorelative pointer</h4><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Pointer_(computer_programming)&amp;action=edit&amp;section=22" title="Edit section: Autorelative pointer"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>An <b>autorelative pointer</b> is a pointer whose value is interpreted as an offset from the address of the pointer itself; thus, if a data structure has an autorelative pointer member that points to some portion of the data structure itself, then the data structure may be relocated in memory without having to update the value of the auto relative pointer.<sup id="cite_ref-12" class="reference"><a href="#cite_note-12"><span class="cite-bracket">&#91;</span>12<span class="cite-bracket">&#93;</span></a></sup> </p><p>The cited patent also uses the term <b>self-relative pointer</b> to mean the same thing. However, the meaning of that term has been used in other ways: </p> <ul><li>to mean an offset from the address of a structure rather than from the address of the pointer itself;<sup class="noprint Inline-Template Template-Fact" style="white-space:nowrap;">&#91;<i><a href="/wiki/Wikipedia:Citation_needed" title="Wikipedia:Citation needed"><span title="This claim needs references to reliable sources. (September 2011)">citation needed</span></a></i>&#93;</sup></li> <li>to mean a pointer containing its own address, which can be useful for reconstructing in any arbitrary region of memory a collection of data structures that point to each other.<sup id="cite_ref-13" class="reference"><a href="#cite_note-13"><span class="cite-bracket">&#91;</span>13<span class="cite-bracket">&#93;</span></a></sup></li></ul> <div class="mw-heading mw-heading4"><h4 id="Based_pointer">Based pointer</h4><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Pointer_(computer_programming)&amp;action=edit&amp;section=23" title="Edit section: Based pointer"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>A <b>based pointer</b> is a pointer whose value is an offset from the value of another pointer. This can be used to store and load blocks of data, assigning the address of the beginning of the block to the base pointer.<sup id="cite_ref-14" class="reference"><a href="#cite_note-14"><span class="cite-bracket">&#91;</span>14<span class="cite-bracket">&#93;</span></a></sup> </p> <div class="mw-heading mw-heading3"><h3 id="Kinds_defined_by_use_or_datatype">Kinds defined by use or datatype</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Pointer_(computer_programming)&amp;action=edit&amp;section=24" title="Edit section: Kinds defined by use or datatype"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <div class="mw-heading mw-heading4"><h4 id="Multiple_indirection">Multiple indirection</h4><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Pointer_(computer_programming)&amp;action=edit&amp;section=25" title="Edit section: Multiple indirection"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>In some languages, a pointer can reference another pointer, requiring multiple dereference operations to get to the original value. While each level of indirection may add a performance cost, it is sometimes necessary in order to provide correct behavior for complex <a href="/wiki/Data_structures" class="mw-redirect" title="Data structures">data structures</a>. For example, in C it is typical to define a <a href="/wiki/Linked_list" title="Linked list">linked list</a> in terms of an element that contains a pointer to the next element of the list: </p> <div class="mw-highlight mw-highlight-lang-c mw-content-ltr" dir="ltr"><pre><span></span><span class="k">struct</span><span class="w"> </span><span class="nc">element</span><span class="w"> </span><span class="p">{</span> <span class="w"> </span><span class="k">struct</span><span class="w"> </span><span class="nc">element</span><span class="w"> </span><span class="o">*</span><span class="n">next</span><span class="p">;</span> <span class="w"> </span><span class="kt">int</span><span class="w"> </span><span class="n">value</span><span class="p">;</span> <span class="p">};</span> <span class="k">struct</span><span class="w"> </span><span class="nc">element</span><span class="w"> </span><span class="o">*</span><span class="n">head</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nb">NULL</span><span class="p">;</span> </pre></div> <p>This implementation uses a pointer to the first element in the list as a surrogate for the entire list. If a new value is added to the beginning of the list, <code>head</code> has to be changed to point to the new element. Since C arguments are always passed by value, using double indirection allows the insertion to be implemented correctly, and has the desirable side-effect of eliminating special case code to deal with insertions at the front of the list: </p> <div class="mw-highlight mw-highlight-lang-c mw-content-ltr" dir="ltr"><pre><span></span><span class="c1">// Given a sorted list at *head, insert the element item at the first</span> <span class="c1">// location where all earlier elements have lesser or equal value.</span> <span class="kt">void</span><span class="w"> </span><span class="nf">insert</span><span class="p">(</span><span class="k">struct</span><span class="w"> </span><span class="nc">element</span><span class="w"> </span><span class="o">**</span><span class="n">head</span><span class="p">,</span><span class="w"> </span><span class="k">struct</span><span class="w"> </span><span class="nc">element</span><span class="w"> </span><span class="o">*</span><span class="n">item</span><span class="p">)</span><span class="w"> </span><span class="p">{</span> <span class="w"> </span><span class="k">struct</span><span class="w"> </span><span class="nc">element</span><span class="w"> </span><span class="o">**</span><span class="n">p</span><span class="p">;</span><span class="w"> </span><span class="c1">// p points to a pointer to an element</span> <span class="w"> </span><span class="k">for</span><span class="w"> </span><span class="p">(</span><span class="n">p</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">head</span><span class="p">;</span><span class="w"> </span><span class="o">*</span><span class="n">p</span><span class="w"> </span><span class="o">!=</span><span class="w"> </span><span class="nb">NULL</span><span class="p">;</span><span class="w"> </span><span class="n">p</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="o">&amp;</span><span class="p">(</span><span class="o">*</span><span class="n">p</span><span class="p">)</span><span class="o">-&gt;</span><span class="n">next</span><span class="p">)</span><span class="w"> </span><span class="p">{</span> <span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="p">(</span><span class="n">item</span><span class="o">-&gt;</span><span class="n">value</span><span class="w"> </span><span class="o">&lt;=</span><span class="w"> </span><span class="p">(</span><span class="o">*</span><span class="n">p</span><span class="p">)</span><span class="o">-&gt;</span><span class="n">value</span><span class="p">)</span> <span class="w"> </span><span class="k">break</span><span class="p">;</span> <span class="w"> </span><span class="p">}</span> <span class="w"> </span><span class="n">item</span><span class="o">-&gt;</span><span class="n">next</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="o">*</span><span class="n">p</span><span class="p">;</span> <span class="w"> </span><span class="o">*</span><span class="n">p</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">item</span><span class="p">;</span> <span class="p">}</span> <span class="c1">// Caller does this:</span> <span class="n">insert</span><span class="p">(</span><span class="o">&amp;</span><span class="n">head</span><span class="p">,</span><span class="w"> </span><span class="n">item</span><span class="p">);</span> </pre></div> <p>In this case, if the value of <code>item</code> is less than that of <code>head</code>, the caller's <code>head</code> is properly updated to the address of the new item. </p><p>A basic example is in the <a href="/wiki/Argv" class="mw-redirect" title="Argv">argv</a> argument to the <a href="/wiki/Main_function#C_and_C++" class="mw-redirect" title="Main function">main function in C (and C++)</a>, which is given in the prototype as <code>char **argv</code>—this is because the variable <code>argv</code> itself is a pointer to an array of strings (an array of arrays), so <code>*argv</code> is a pointer to the 0th string (by convention the name of the program), and <code>**argv</code> is the 0th character of the 0th string. </p> <div class="mw-heading mw-heading4"><h4 id="Function_pointer">Function pointer</h4><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Pointer_(computer_programming)&amp;action=edit&amp;section=26" title="Edit section: Function pointer"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>In some languages, a pointer can reference executable code, i.e., it can point to a function, method, or procedure. A <a href="/wiki/Function_pointer" title="Function pointer">function pointer</a> will store the address of a function to be invoked. While this facility can be used to call functions dynamically, it is often a favorite technique of virus and other malicious software writers. </p> <div class="mw-highlight mw-highlight-lang-c mw-content-ltr" dir="ltr"><pre><span></span><span class="kt">int</span><span class="w"> </span><span class="nf">sum</span><span class="p">(</span><span class="kt">int</span><span class="w"> </span><span class="n">n1</span><span class="p">,</span><span class="w"> </span><span class="kt">int</span><span class="w"> </span><span class="n">n2</span><span class="p">)</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="c1">// Function with two integer parameters returning an integer value</span> <span class="w"> </span><span class="k">return</span><span class="w"> </span><span class="n">n1</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="n">n2</span><span class="p">;</span> <span class="p">}</span> <span class="kt">int</span><span class="w"> </span><span class="nf">main</span><span class="p">(</span><span class="kt">void</span><span class="p">)</span><span class="w"> </span><span class="p">{</span> <span class="w"> </span><span class="kt">int</span><span class="w"> </span><span class="n">a</span><span class="p">,</span><span class="w"> </span><span class="n">b</span><span class="p">,</span><span class="w"> </span><span class="n">x</span><span class="p">,</span><span class="w"> </span><span class="n">y</span><span class="p">;</span> <span class="w"> </span><span class="kt">int</span><span class="w"> </span><span class="p">(</span><span class="o">*</span><span class="n">fp</span><span class="p">)(</span><span class="kt">int</span><span class="p">,</span><span class="w"> </span><span class="kt">int</span><span class="p">);</span><span class="w"> </span><span class="c1">// Function pointer which can point to a function like sum</span> <span class="w"> </span><span class="n">fp</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="o">&amp;</span><span class="n">sum</span><span class="p">;</span><span class="w"> </span><span class="c1">// fp now points to function sum</span> <span class="w"> </span><span class="n">x</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">(</span><span class="o">*</span><span class="n">fp</span><span class="p">)(</span><span class="n">a</span><span class="p">,</span><span class="w"> </span><span class="n">b</span><span class="p">);</span><span class="w"> </span><span class="c1">// Calls function sum with arguments a and b</span> <span class="w"> </span><span class="n">y</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">sum</span><span class="p">(</span><span class="n">a</span><span class="p">,</span><span class="w"> </span><span class="n">b</span><span class="p">);</span><span class="w"> </span><span class="c1">// Calls function sum with arguments a and b</span> <span class="p">}</span> </pre></div> <div class="mw-heading mw-heading4"><h4 id="Back_pointer">Back pointer</h4><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Pointer_(computer_programming)&amp;action=edit&amp;section=27" title="Edit section: Back pointer"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>In doubly <a href="/wiki/Linked_list" title="Linked list">linked lists</a> or <a href="/wiki/Tree_(data_structure)" class="mw-redirect" title="Tree (data structure)">tree structures</a>, a back pointer held on an element 'points back' to the item referring to the current element. These are useful for navigation and manipulation, at the expense of greater memory use. </p> <div class="mw-heading mw-heading2"><h2 id="Simulation_using_an_array_index">Simulation using an array index</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Pointer_(computer_programming)&amp;action=edit&amp;section=28" title="Edit section: Simulation using an array index"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>It is possible to simulate pointer behavior using an index to an (normally one-dimensional) array. </p><p>Primarily for languages which do not support pointers explicitly but <i>do</i> support arrays, the <a href="/wiki/Array_data_type" class="mw-redirect" title="Array data type">array</a> can be thought of and processed as if it were the entire memory range (within the scope of the particular array) and any index to it can be thought of as equivalent to a <a href="/wiki/General-purpose_register" class="mw-redirect" title="General-purpose register">general-purpose register</a> in assembly language (that points to the individual bytes but whose actual value is relative to the start of the array, not its absolute address in memory). Assuming the array is, say, a contiguous 16 <a href="/wiki/Megabyte" title="Megabyte">megabyte</a> character <a href="/wiki/Data_structure" title="Data structure">data structure</a>, individual bytes (or a <a href="/wiki/String_(computer_science)" title="String (computer science)">string</a> of contiguous bytes within the array) can be directly addressed and manipulated using the name of the array with a 31 bit unsigned <a href="/wiki/Integer" title="Integer">integer</a> as the simulated pointer (this is quite similar to the <i>C arrays</i> example shown above). Pointer arithmetic can be simulated by adding or subtracting from the index, with minimal additional overhead compared to genuine pointer arithmetic. </p><p>It is even theoretically possible, using the above technique, together with a suitable <a href="/wiki/Instruction_set_simulator" title="Instruction set simulator">instruction set simulator</a> to simulate <i>any</i> <a href="/wiki/Machine_code" title="Machine code">machine code</a> or the intermediate (<a href="/wiki/Byte_code" class="mw-redirect" title="Byte code">byte code</a>) of <i>any</i> processor/language in another language that does not support pointers at all (for example <a href="/wiki/Java_(programming_language)" title="Java (programming language)">Java</a> / <a href="/wiki/JavaScript" title="JavaScript">JavaScript</a>). To achieve this, the <a href="/wiki/Binary_numeral_system" class="mw-redirect" title="Binary numeral system">binary</a> code can initially be loaded into contiguous bytes of the array for the simulator to "read", interpret and execute entirely within the memory containing the same array. If necessary, to completely avoid <a href="/wiki/Buffer_overflow" title="Buffer overflow">buffer overflow</a> problems, <a href="/wiki/Bounds_checking" title="Bounds checking">bounds checking</a> can usually be inserted by the compiler (or if not, hand coded in the simulator). </p> <div class="mw-heading mw-heading2"><h2 id="Support_in_various_programming_languages">Support in various programming languages</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Pointer_(computer_programming)&amp;action=edit&amp;section=29" title="Edit section: Support in various programming languages"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <div class="mw-heading mw-heading3"><h3 id="Ada">Ada</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Pointer_(computer_programming)&amp;action=edit&amp;section=30" title="Edit section: Ada"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p><a href="/wiki/Ada_(programming_language)" title="Ada (programming language)">Ada</a> is a strongly typed language where all pointers are typed and only safe type conversions are permitted. All pointers are by default initialized to <code>null</code>, and any attempt to access data through a <code>null</code> pointer causes an <a href="/wiki/Exception_handling" title="Exception handling">exception</a> to be raised. Pointers in Ada are called <i><a href="/wiki/Access_type" class="mw-redirect" title="Access type">access types</a></i>. Ada&#160;83 did not permit arithmetic on access types (although many compiler vendors provided for it as a non-standard feature), but Ada&#160;95 supports “safe” arithmetic on access types via the package <code>System.Storage_Elements</code>. </p> <div class="mw-heading mw-heading3"><h3 id="BASIC">BASIC</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Pointer_(computer_programming)&amp;action=edit&amp;section=31" title="Edit section: BASIC"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>Several old versions of <a href="/wiki/BASIC" title="BASIC">BASIC</a> for the Windows platform had support for STRPTR() to return the address of a string, and for VARPTR() to return the address of a variable. Visual Basic 5 also had support for OBJPTR() to return the address of an object interface, and for an ADDRESSOF operator to return the address of a function. The types of all of these are integers, but their values are equivalent to those held by pointer types. </p><p>Newer dialects of <a href="/wiki/BASIC" title="BASIC">BASIC</a>, such as <a href="/wiki/FreeBASIC" title="FreeBASIC">FreeBASIC</a> or <a href="/wiki/BlitzMax" class="mw-redirect" title="BlitzMax">BlitzMax</a>, have exhaustive pointer implementations, however. In FreeBASIC, arithmetic on <code>ANY</code> pointers (equivalent to C's <code>void*</code>) are treated as though the <code>ANY</code> pointer was a byte width. <code>ANY</code> pointers cannot be dereferenced, as in C. Also, casting between <code>ANY</code> and any other type's pointers will not generate any warnings. </p> <div class="mw-highlight mw-highlight-lang-blitzmax mw-content-ltr" dir="ltr"><pre><span></span><span class="nv">dim</span><span class="w"> </span><span class="nv">as</span><span class="w"> </span><span class="nv">integer</span><span class="w"> </span><span class="nv">f</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">257</span> <span class="nv">dim</span><span class="w"> </span><span class="nv">as</span><span class="w"> </span><span class="nv">any</span><span class="w"> </span><span class="kt">ptr</span><span class="w"> </span><span class="nv">g</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="err">@</span><span class="nv">f</span> <span class="nv">dim</span><span class="w"> </span><span class="nv">as</span><span class="w"> </span><span class="nv">integer</span><span class="w"> </span><span class="kt">ptr</span><span class="w"> </span><span class="nv">i</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nv">g</span> <span class="nf">assert</span><span class="p">(</span><span class="o">*</span><span class="nv">i</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">257</span><span class="p">)</span> <span class="nf">assert</span><span class="p">(</span><span class="w"> </span><span class="p">(</span><span class="nv">g</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="mi">4</span><span class="p">)</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">(</span><span class="err">@</span><span class="nv">f</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="mi">1</span><span class="p">)</span><span class="w"> </span><span class="p">)</span> </pre></div> <div class="mw-heading mw-heading3"><h3 id="C_and_C++"><span id="C_and_C.2B.2B"></span>C and C++</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Pointer_(computer_programming)&amp;action=edit&amp;section=32" title="Edit section: C and C++"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>In <a href="/wiki/C_(programming_language)" title="C (programming language)">C</a> and <a href="/wiki/C%2B%2B" title="C++">C++</a> pointers are variables that store addresses and can be <i>null</i>. Each pointer has a type it points to, but one can freely cast between pointer types (but not between a function pointer and an object pointer). A special pointer type called the “void pointer” allows pointing to any (non-function) object, but is limited by the fact that it cannot be dereferenced directly (it shall be cast). The address itself can often be directly manipulated by casting a pointer to and from an integral type of sufficient size, though the results are implementation-defined and may indeed cause undefined behavior; while earlier C standards did not have an integral type that was guaranteed to be large enough, <a href="/wiki/C99" title="C99">C99</a> specifies the <code>uintptr_t</code> <i><a href="/wiki/Typedef" title="Typedef">typedef</a> name</i> defined in <code><a href="/wiki/C_data_types#Fixed-width_integer_types" title="C data types">&lt;stdint.h&gt;</a></code>, but an implementation need not provide it. </p><p><a href="/wiki/C%2B%2B" title="C++">C++</a> fully supports C pointers and C typecasting. It also supports a new group of typecasting operators to help catch some unintended dangerous casts at compile-time. Since <a href="/wiki/C%2B%2B11" title="C++11">C++11</a>, the <a href="/wiki/C%2B%2B_Standard_Library" title="C++ Standard Library">C++ standard library</a> also provides <a href="/wiki/Smart_pointer" title="Smart pointer">smart pointers</a> (<code>unique_ptr</code>, <code>shared_ptr</code> and <code>weak_ptr</code>) which can be used in some situations as a safer alternative to primitive C pointers. C++ also supports another form of reference, quite different from a pointer, called simply a <i><a href="/wiki/Reference_(C%2B%2B)" title="Reference (C++)">reference</a></i> or <i>reference type</i>. </p><p><b>Pointer arithmetic</b>, that is, the ability to modify a pointer's target address with arithmetic operations (as well as magnitude comparisons), is restricted by the language standard to remain within the bounds of a single array object (or just after it), and will otherwise invoke <a href="/wiki/Undefined_behavior" title="Undefined behavior">undefined behavior</a>. Adding or subtracting from a pointer moves it by a multiple of the size of its <a href="/wiki/Datatype" class="mw-redirect" title="Datatype">datatype</a>. For example, adding 1 to a pointer to 4-byte integer values will increment the pointer's pointed-to byte-address by 4. This has the effect of incrementing the pointer to point at the next element in a contiguous array of integers—which is often the intended result. Pointer arithmetic cannot be performed on <code>void</code> pointers because the <a href="/wiki/Void_type" title="Void type">void type</a> has no size, and thus the pointed address can not be added to, although <a href="/wiki/GNU_Compiler_Collection" title="GNU Compiler Collection">gcc</a> and other compilers will perform byte arithmetic on <code>void*</code> as a non-standard extension, treating it as if it were <code>char *</code>. </p><p>Pointer arithmetic provides the programmer with a single way of dealing with different types: adding and subtracting the number of elements required instead of the actual offset in bytes. (Pointer arithmetic with <code>char *</code> pointers uses byte offsets, because <code>sizeof(char)</code> is 1 by definition.) In particular, the C definition explicitly declares that the syntax <code>a[n]</code>, which is the <code>n</code>-th element of the array <code>a</code>, is equivalent to <code>*(a + n)</code>, which is the content of the element pointed by <code>a + n</code>. This implies that <code>n[a]</code> is equivalent to <code>a[n]</code>, and one can write, e.g., <code>a[3]</code> or <code>3[a]</code> equally well to access the fourth element of an array <code>a</code>. </p><p>While powerful, pointer arithmetic can be a source of <a href="/wiki/Software_bug" title="Software bug">computer bugs</a>. It tends to confuse novice <a href="/wiki/Programmer" title="Programmer">programmers</a>, forcing them into different contexts: an expression can be an ordinary arithmetic one or a pointer arithmetic one, and sometimes it is easy to mistake one for the other. In response to this, many modern high-level computer languages (for example <a href="/wiki/Java_(programming_language)" title="Java (programming language)">Java</a>) do not permit direct access to memory using addresses. Also, the safe C dialect <a href="/wiki/Cyclone_programming_language" class="mw-redirect" title="Cyclone programming language">Cyclone</a> addresses many of the issues with pointers. See <a href="/wiki/C_(programming_language)#Pointers" title="C (programming language)">C programming language</a> for more discussion. </p><p>The <b><code>void</code> pointer</b>, or <b><code>void*</code></b>, is supported in ANSI C and C++ as a generic pointer type. A pointer to <code>void</code> can store the address of any object (not function),<sup id="cite_ref-16" class="reference"><a href="#cite_note-16"><span class="cite-bracket">&#91;</span>a<span class="cite-bracket">&#93;</span></a></sup> and, in C, is implicitly converted to any other object pointer type on assignment, but it must be explicitly cast if dereferenced. <a href="/wiki/The_C_Programming_Language" title="The C Programming Language">K&amp;R</a> C used <code>char*</code> for the “type-agnostic pointer” purpose (before ANSI C). </p> <div class="mw-highlight mw-highlight-lang-c mw-content-ltr" dir="ltr"><pre><span></span><span class="kt">int</span><span class="w"> </span><span class="n">x</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">4</span><span class="p">;</span> <span class="kt">void</span><span class="o">*</span><span class="w"> </span><span class="n">p1</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="o">&amp;</span><span class="n">x</span><span class="p">;</span> <span class="kt">int</span><span class="o">*</span><span class="w"> </span><span class="n">p2</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">p1</span><span class="p">;</span><span class="w"> </span><span class="c1">// void* implicitly converted to int*: valid C, but not C++</span> <span class="kt">int</span><span class="w"> </span><span class="n">a</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="o">*</span><span class="n">p2</span><span class="p">;</span> <span class="kt">int</span><span class="w"> </span><span class="n">b</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="o">*</span><span class="p">(</span><span class="kt">int</span><span class="o">*</span><span class="p">)</span><span class="n">p1</span><span class="p">;</span><span class="w"> </span><span class="c1">// when dereferencing inline, there is no implicit conversion</span> </pre></div> <p>C++ does not allow the implicit conversion of <code>void*</code> to other pointer types, even in assignments. This was a design decision to avoid careless and even unintended casts, though most compilers only output warnings, not errors, when encountering other casts. </p> <div class="mw-highlight mw-highlight-lang-cpp mw-content-ltr" dir="ltr"><pre><span></span><span class="kt">int</span><span class="w"> </span><span class="n">x</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">4</span><span class="p">;</span> <span class="kt">void</span><span class="o">*</span><span class="w"> </span><span class="n">p1</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="o">&amp;</span><span class="n">x</span><span class="p">;</span> <span class="kt">int</span><span class="o">*</span><span class="w"> </span><span class="n">p2</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">p1</span><span class="p">;</span><span class="w"> </span><span class="c1">// this fails in C++: there is no implicit conversion from void*</span> <span class="kt">int</span><span class="o">*</span><span class="w"> </span><span class="n">p3</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">(</span><span class="kt">int</span><span class="o">*</span><span class="p">)</span><span class="n">p1</span><span class="p">;</span><span class="w"> </span><span class="c1">// C-style cast</span> <span class="kt">int</span><span class="o">*</span><span class="w"> </span><span class="n">p4</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="k">reinterpret_cast</span><span class="o">&lt;</span><span class="kt">int</span><span class="o">*&gt;</span><span class="p">(</span><span class="n">p1</span><span class="p">);</span><span class="w"> </span><span class="c1">// C++ cast</span> </pre></div> <p>In C++, there is no <code>void&amp;</code> (reference to void) to complement <code>void*</code> (pointer to void), because references behave like aliases to the variables they point to, and there can never be a variable whose type is <code>void</code>. </p> <div class="mw-heading mw-heading4"><h4 id="Pointer-to-member">Pointer-to-member</h4><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Pointer_(computer_programming)&amp;action=edit&amp;section=33" title="Edit section: Pointer-to-member"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>In C++ pointers to non-static members of a class can be defined. If a class <code>C</code> has a member <code>T a</code> then <code>&amp;C::a</code> is a pointer to the member <code>a</code> of type <code>T C::*</code>. This member can be an object or a <a href="/wiki/Function_pointer#Method_pointers" title="Function pointer">function</a>.<sup id="cite_ref-17" class="reference"><a href="#cite_note-17"><span class="cite-bracket">&#91;</span>16<span class="cite-bracket">&#93;</span></a></sup> They can be used on the right-hand side of operators <code>.*</code> and <code>-&gt;*</code> to access the corresponding member. </p> <div class="mw-highlight mw-highlight-lang-cpp mw-content-ltr" dir="ltr"><pre><span></span><span class="k">struct</span><span class="w"> </span><span class="nc">S</span><span class="w"> </span><span class="p">{</span> <span class="kt">int</span><span class="w"> </span><span class="n">a</span><span class="p">;</span> <span class="kt">int</span><span class="w"> </span><span class="nf">f</span><span class="p">()</span><span class="w"> </span><span class="k">const</span><span class="w"> </span><span class="p">{</span><span class="k">return</span><span class="w"> </span><span class="n">a</span><span class="p">;}</span> <span class="p">};</span> <span class="n">S</span><span class="w"> </span><span class="n">s1</span><span class="p">{};</span> <span class="n">S</span><span class="o">*</span><span class="w"> </span><span class="n">ptrS</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="o">&amp;</span><span class="n">s1</span><span class="p">;</span> <span class="kt">int</span><span class="w"> </span><span class="n">S</span><span class="o">::*</span><span class="w"> </span><span class="n">ptr</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="o">&amp;</span><span class="n">S</span><span class="o">::</span><span class="n">a</span><span class="p">;</span><span class="w"> </span><span class="c1">// pointer to S::a</span> <span class="kt">int</span><span class="w"> </span><span class="p">(</span><span class="n">S</span><span class="o">::*</span><span class="w"> </span><span class="n">fp</span><span class="p">)()</span><span class="k">const</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="o">&amp;</span><span class="n">S</span><span class="o">::</span><span class="n">f</span><span class="p">;</span><span class="w"> </span><span class="c1">// pointer to S::f</span> <span class="n">s1</span><span class="p">.</span><span class="o">*</span><span class="n">ptr</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">1</span><span class="p">;</span> <span class="n">std</span><span class="o">::</span><span class="n">cout</span><span class="w"> </span><span class="o">&lt;&lt;</span><span class="w"> </span><span class="p">(</span><span class="n">s1</span><span class="p">.</span><span class="o">*</span><span class="n">fp</span><span class="p">)()</span><span class="w"> </span><span class="o">&lt;&lt;</span><span class="w"> </span><span class="s">&quot;</span><span class="se">\n</span><span class="s">&quot;</span><span class="p">;</span><span class="w"> </span><span class="c1">// prints 1</span> <span class="n">ptrS</span><span class="o">-&gt;*</span><span class="n">ptr</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">2</span><span class="p">;</span> <span class="n">std</span><span class="o">::</span><span class="n">cout</span><span class="w"> </span><span class="o">&lt;&lt;</span><span class="w"> </span><span class="p">(</span><span class="n">ptrS</span><span class="o">-&gt;*</span><span class="n">fp</span><span class="p">)()</span><span class="w"> </span><span class="o">&lt;&lt;</span><span class="w"> </span><span class="s">&quot;</span><span class="se">\n</span><span class="s">&quot;</span><span class="p">;</span><span class="w"> </span><span class="c1">// prints 2</span> </pre></div> <div class="mw-heading mw-heading4"><h4 id="Pointer_declaration_syntax_overview">Pointer declaration syntax overview</h4><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Pointer_(computer_programming)&amp;action=edit&amp;section=34" title="Edit section: Pointer declaration syntax overview"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>These pointer declarations cover most variants of pointer declarations. Of course it is possible to have triple pointers, but the main principles behind a triple pointer already exist in a double pointer. The naming used here is what the expression <code>typeid(type).name()</code> equals for each of these types when using <a href="/wiki/G%2B%2B" class="mw-redirect" title="G++">g++</a> or <a href="/wiki/Clang" title="Clang">clang</a>.<sup id="cite_ref-18" class="reference"><a href="#cite_note-18"><span class="cite-bracket">&#91;</span>17<span class="cite-bracket">&#93;</span></a></sup><sup id="cite_ref-19" class="reference"><a href="#cite_note-19"><span class="cite-bracket">&#91;</span>18<span class="cite-bracket">&#93;</span></a></sup> </p> <div class="mw-highlight mw-highlight-lang-c mw-content-ltr" dir="ltr"><pre><span></span><span class="kt">char</span><span class="w"> </span><span class="n">A5_A5_c</span><span class="w"> </span><span class="p">[</span><span class="mi">5</span><span class="p">][</span><span class="mi">5</span><span class="p">];</span><span class="w"> </span><span class="cm">/* array of arrays of chars */</span> <span class="kt">char</span><span class="w"> </span><span class="o">*</span><span class="n">A5_Pc</span><span class="w"> </span><span class="p">[</span><span class="mi">5</span><span class="p">];</span><span class="w"> </span><span class="cm">/* array of pointers to chars */</span> <span class="kt">char</span><span class="w"> </span><span class="o">**</span><span class="n">PPc</span><span class="p">;</span><span class="w"> </span><span class="cm">/* pointer to pointer to char (&quot;double pointer&quot;) */</span> <span class="kt">char</span><span class="w"> </span><span class="p">(</span><span class="o">*</span><span class="n">PA5_c</span><span class="p">)</span><span class="w"> </span><span class="p">[</span><span class="mi">5</span><span class="p">];</span><span class="w"> </span><span class="cm">/* pointer to array(s) of chars */</span> <span class="kt">char</span><span class="w"> </span><span class="o">*</span><span class="nf">FPcvE</span><span class="p">();</span><span class="w"> </span><span class="cm">/* function which returns a pointer to char(s) */</span> <span class="kt">char</span><span class="w"> </span><span class="p">(</span><span class="o">*</span><span class="n">PFcvE</span><span class="p">)();</span><span class="w"> </span><span class="cm">/* pointer to a function which returns a char */</span> <span class="kt">char</span><span class="w"> </span><span class="p">(</span><span class="o">*</span><span class="n">FPA5_cvE</span><span class="p">())[</span><span class="mi">5</span><span class="p">];</span><span class="w"> </span><span class="cm">/* function which returns pointer to an array of chars */</span> <span class="kt">char</span><span class="w"> </span><span class="p">(</span><span class="o">*</span><span class="n">A5_PFcvE</span><span class="p">[</span><span class="mi">5</span><span class="p">])();</span><span class="w"> </span><span class="cm">/* an array of pointers to functions which return a char */</span> </pre></div> <p>The following declarations involving pointers-to-member are valid only in C++: </p> <div class="mw-highlight mw-highlight-lang-cpp mw-content-ltr" dir="ltr"><pre><span></span><span class="k">class</span><span class="w"> </span><span class="nc">C</span><span class="p">;</span> <span class="k">class</span><span class="w"> </span><span class="nc">D</span><span class="p">;</span> <span class="kt">char</span><span class="w"> </span><span class="n">C</span><span class="o">::*</span><span class="w"> </span><span class="n">M1Cc</span><span class="p">;</span><span class="w"> </span><span class="cm">/* pointer-to-member to char */</span> <span class="kt">char</span><span class="w"> </span><span class="n">C</span><span class="o">::*</span><span class="n">A5_M1Cc</span><span class="w"> </span><span class="p">[</span><span class="mi">5</span><span class="p">];</span><span class="w"> </span><span class="cm">/* array of pointers-to-member to char */</span> <span class="kt">char</span><span class="o">*</span><span class="w"> </span><span class="n">C</span><span class="o">::*</span><span class="w"> </span><span class="n">M1CPc</span><span class="p">;</span><span class="w"> </span><span class="cm">/* pointer-to-member to pointer to char(s) */</span> <span class="kt">char</span><span class="w"> </span><span class="n">C</span><span class="o">::**</span><span class="w"> </span><span class="n">PM1Cc</span><span class="p">;</span><span class="w"> </span><span class="cm">/* pointer to pointer-to-member to char */</span> <span class="kt">char</span><span class="w"> </span><span class="p">(</span><span class="o">*</span><span class="n">M1CA5_c</span><span class="p">)</span><span class="w"> </span><span class="p">[</span><span class="mi">5</span><span class="p">];</span><span class="w"> </span><span class="cm">/* pointer-to-member to array(s) of chars */</span> <span class="kt">char</span><span class="w"> </span><span class="n">C</span><span class="o">::*</span><span class="w"> </span><span class="nf">FM1CcvE</span><span class="p">();</span><span class="w"> </span><span class="cm">/* function which returns a pointer-to-member to char */</span> <span class="kt">char</span><span class="w"> </span><span class="n">D</span><span class="o">::*</span><span class="w"> </span><span class="n">C</span><span class="o">::*</span><span class="w"> </span><span class="n">M1CM1Dc</span><span class="p">;</span><span class="w"> </span><span class="cm">/* pointer-to-member to pointer-to-member to pointer to char(s) */</span> <span class="kt">char</span><span class="w"> </span><span class="n">C</span><span class="o">::*</span><span class="w"> </span><span class="n">C</span><span class="o">::*</span><span class="w"> </span><span class="n">M1CMS_c</span><span class="p">;</span><span class="w"> </span><span class="cm">/* pointer-to-member to pointer-to-member to pointer to char(s) */</span> <span class="kt">char</span><span class="w"> </span><span class="p">(</span><span class="n">C</span><span class="o">::*</span><span class="w"> </span><span class="n">FM1CA5_cvE</span><span class="p">())[</span><span class="mi">5</span><span class="p">];</span><span class="w"> </span><span class="cm">/* function which returns pointer-to-member to an array of chars */</span> <span class="kt">char</span><span class="w"> </span><span class="p">(</span><span class="n">C</span><span class="o">::*</span><span class="w"> </span><span class="n">M1CFcvE</span><span class="p">)()</span><span class="w"> </span><span class="cm">/* pointer-to-member-function which returns a char */</span> <span class="kt">char</span><span class="w"> </span><span class="p">(</span><span class="n">C</span><span class="o">::*</span><span class="w"> </span><span class="n">A5_M1CFcvE</span><span class="p">[</span><span class="mi">5</span><span class="p">])();</span><span class="w"> </span><span class="cm">/* an array of pointers-to-member-functions which return a char */</span> </pre></div> <p>The <code>()</code> and <code>[]</code> have a higher priority than <code>*</code>. <sup id="cite_ref-20" class="reference"><a href="#cite_note-20"><span class="cite-bracket">&#91;</span>19<span class="cite-bracket">&#93;</span></a></sup> </p> <div class="mw-heading mw-heading3"><h3 id="C#"><span id="C.23"></span>C#</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Pointer_(computer_programming)&amp;action=edit&amp;section=35" title="Edit section: C#"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>In the <a href="/wiki/C_Sharp_(programming_language)" title="C Sharp (programming language)">C# programming language</a>, pointers are supported by either marking blocks of code that include pointers with the <code>unsafe</code> keyword, or by <code>using</code> the <code>System.Runtime.CompilerServices</code> assembly provisions for pointer access. The syntax is essentially the same as in C++, and the address pointed can be either <a href="/wiki/Managed_code" title="Managed code">managed</a> or <a href="/wiki/Managed_code" title="Managed code">unmanaged</a> memory. However, pointers to managed memory (any pointer to a managed object) must be declared using the <code>fixed</code> keyword, which prevents the <a href="/wiki/Garbage_collection_(computer_science)" title="Garbage collection (computer science)">garbage collector</a> from moving the pointed object as part of memory management while the pointer is in scope, thus keeping the pointer address valid. </p><p>However, an exception to this is from using the <code>IntPtr</code> structure, which is a memory managed equivalent to <code>int*</code>, and does not require the <code>unsafe</code> keyword nor the <code>CompilerServices</code> assembly. This type is often returned when using methods from the <code>System.Runtime.InteropServices</code>, for example: </p> <div class="mw-highlight mw-highlight-lang-csharp mw-content-ltr" dir="ltr"><pre><span></span><span class="c1">// Get 16 bytes of memory from the process&#39;s unmanaged memory</span> <span class="n">IntPtr</span><span class="w"> </span><span class="n">pointer</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">System</span><span class="p">.</span><span class="n">Runtime</span><span class="p">.</span><span class="n">InteropServices</span><span class="p">.</span><span class="n">Marshal</span><span class="p">.</span><span class="n">AllocHGlobal</span><span class="p">(</span><span class="m">16</span><span class="p">);</span> <span class="c1">// Do something with the allocated memory</span> <span class="c1">// Free the allocated memory</span> <span class="n">System</span><span class="p">.</span><span class="n">Runtime</span><span class="p">.</span><span class="n">InteropServices</span><span class="p">.</span><span class="n">Marshal</span><span class="p">.</span><span class="n">FreeHGlobal</span><span class="p">(</span><span class="n">pointer</span><span class="p">);</span> </pre></div> <p>The <a href="/wiki/.NET_Framework" title=".NET Framework">.NET framework</a> includes many classes and methods in the <code>System</code> and <code>System.Runtime.InteropServices</code> namespaces (such as the <code>Marshal</code> class) which convert .NET types (for example, <code>System.String</code>) to and from many <a href="/wiki/Managed_code" title="Managed code">unmanaged</a> types and pointers (for example, <code>LPWSTR</code> or <code>void*</code>) to allow communication with <a href="/wiki/Managed_code" title="Managed code">unmanaged code</a>. Most such methods have the same security permission requirements as unmanaged code, since they can affect arbitrary places in memory. </p> <div class="mw-heading mw-heading3"><h3 id="COBOL">COBOL</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Pointer_(computer_programming)&amp;action=edit&amp;section=36" title="Edit section: COBOL"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>The <a href="/wiki/COBOL" title="COBOL">COBOL</a> programming language supports pointers to variables. Primitive or group (record) data objects declared within the <code>LINKAGE SECTION</code> of a program are inherently pointer-based, where the only memory allocated within the program is space for the address of the data item (typically a single memory word). In program source code, these data items are used just like any other <code>WORKING-STORAGE</code> variable, but their contents are implicitly accessed indirectly through their <code>LINKAGE</code> pointers. </p><p>Memory space for each pointed-to data object is typically <a href="/wiki/Dynamic_memory_allocation" class="mw-redirect" title="Dynamic memory allocation">allocated dynamically</a> using external <a href="/wiki/Subroutine" class="mw-redirect" title="Subroutine"><code>CALL</code></a> statements or via embedded extended language constructs such as <a href="/wiki/EXEC_CICS" class="mw-redirect" title="EXEC CICS"><code>EXEC CICS</code></a> or <a href="/wiki/SQL" title="SQL"><code>EXEC SQL</code></a> statements. </p><p>Extended versions of COBOL also provide pointer variables declared with <code>USAGE</code> <code>IS</code> <code>POINTER</code> clauses. The values of such pointer variables are established and modified using <code>SET</code> and <code>SET</code> <code>ADDRESS</code> statements. </p><p>Some extended versions of COBOL also provide <code>PROCEDURE-POINTER</code> variables, which are capable of storing the <a href="/wiki/Function_pointer" title="Function pointer">addresses of executable code</a>. </p> <div class="mw-heading mw-heading3"><h3 id="PL/I"><span id="PL.2FI"></span>PL/I</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Pointer_(computer_programming)&amp;action=edit&amp;section=37" title="Edit section: PL/I"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>The <a href="/wiki/PL/I" title="PL/I">PL/I</a> language provides full support for pointers to all data types (including pointers to structures), <a href="/wiki/Recursion" title="Recursion">recursion</a>, <a href="/wiki/Computer_multitasking" title="Computer multitasking">multitasking</a>, string handling, and extensive built-in <a href="/wiki/Subroutine" class="mw-redirect" title="Subroutine">functions</a>. PL/I was quite a leap forward compared to the programming languages of its time.<sup class="noprint Inline-Template Template-Fact" style="white-space:nowrap;">&#91;<i><a href="/wiki/Wikipedia:Citation_needed" title="Wikipedia:Citation needed"><span title="This claim needs references to reliable sources. (February 2014)">citation needed</span></a></i>&#93;</sup> PL/I pointers are untyped, and therefore no casting is required for pointer dereferencing or assignment. The declaration syntax for a pointer is <code>DECLARE xxx POINTER;</code>, which declares a pointer named "xxx". Pointers are used with <code>BASED</code> variables. A based variable can be declared with a default locator (<code>DECLARE xxx BASED(ppp);</code> or without (<code>DECLARE xxx BASED;</code>), where xxx is a based variable, which may be an element variable, a structure, or an array, and ppp is the default pointer). Such a variable can be address without an explicit pointer reference (<code>xxx=1;</code>, or may be addressed with an explicit reference to the default locator (ppp), or to any other pointer (<code>qqq-&gt;xxx=1;</code>). </p><p>Pointer arithmetic is not part of the PL/I standard, but many compilers allow expressions of the form <code>ptr = ptr±expression</code>. IBM PL/I also has the builtin function <code>PTRADD</code> to perform the arithmetic. Pointer arithmetic is always performed in bytes. </p><p>IBM <i>Enterprise</i> PL/I compilers have a new form of typed pointer called a <code>HANDLE</code>. </p> <div class="mw-heading mw-heading3"><h3 id="D">D</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Pointer_(computer_programming)&amp;action=edit&amp;section=38" title="Edit section: D"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>The <a href="/wiki/D_(programming_language)" title="D (programming language)">D programming language</a> is a derivative of C and C++ which fully supports C pointers and C typecasting. </p> <div class="mw-heading mw-heading3"><h3 id="Eiffel">Eiffel</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Pointer_(computer_programming)&amp;action=edit&amp;section=39" title="Edit section: Eiffel"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>The <a href="/wiki/Eiffel_(programming_language)" title="Eiffel (programming language)">Eiffel object-oriented language</a> employs value and reference semantics without pointer arithmetic. Nevertheless, pointer classes are provided. They offer pointer arithmetic, typecasting, explicit memory management, interfacing with non-Eiffel software, and other features. </p> <div class="mw-heading mw-heading3"><h3 id="Fortran">Fortran</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Pointer_(computer_programming)&amp;action=edit&amp;section=40" title="Edit section: Fortran"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p><a href="/wiki/Fortran" title="Fortran">Fortran-90</a> introduced a strongly typed pointer capability. Fortran pointers contain more than just a simple memory address. They also encapsulate the lower and upper bounds of array dimensions, strides (for example, to support arbitrary array sections), and other metadata. An <i>association operator</i>, <code>=&gt;</code> is used to associate a <code>POINTER</code> to a variable which has a <code>TARGET</code> attribute. The Fortran-90 <code>ALLOCATE</code> statement may also be used to associate a pointer to a block of memory. For example, the following code might be used to define and create a linked list structure: </p> <div class="mw-highlight mw-highlight-lang-fortran mw-content-ltr" dir="ltr"><pre><span></span><span class="k">type </span><span class="n">real_list_t</span> <span class="w"> </span><span class="kt">real</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">sample_data</span><span class="p">(</span><span class="mi">100</span><span class="p">)</span> <span class="w"> </span><span class="k">type</span><span class="w"> </span><span class="p">(</span><span class="n">real_list_t</span><span class="p">),</span><span class="w"> </span><span class="k">pointer</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">next</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="nb">null</span><span class="w"> </span><span class="p">()</span> <span class="k">end type</span> <span class="k">type</span><span class="w"> </span><span class="p">(</span><span class="n">real_list_t</span><span class="p">),</span><span class="w"> </span><span class="k">target</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">my_real_list</span> <span class="k">type</span><span class="w"> </span><span class="p">(</span><span class="n">real_list_t</span><span class="p">),</span><span class="w"> </span><span class="k">pointer</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">real_list_temp</span> <span class="n">real_list_temp</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="n">my_real_list</span> <span class="k">do</span> <span class="k"> read</span><span class="w"> </span><span class="p">(</span><span class="mi">1</span><span class="p">,</span><span class="n">iostat</span><span class="o">=</span><span class="n">ioerr</span><span class="p">)</span><span class="w"> </span><span class="n">real_list_temp</span><span class="p">%</span><span class="n">sample_data</span> <span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="p">(</span><span class="n">ioerr</span><span class="w"> </span><span class="o">/=</span><span class="w"> </span><span class="mi">0</span><span class="p">)</span><span class="w"> </span><span class="k">exit</span> <span class="k"> allocate</span><span class="w"> </span><span class="p">(</span><span class="n">real_list_temp</span><span class="p">%</span><span class="n">next</span><span class="p">)</span> <span class="w"> </span><span class="n">real_list_temp</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="n">real_list_temp</span><span class="p">%</span><span class="n">next</span> <span class="k">end do</span> </pre></div> <p>Fortran-2003 adds support for procedure pointers. Also, as part of the <i>C Interoperability</i> feature, Fortran-2003 supports intrinsic functions for converting C-style pointers into Fortran pointers and back. </p> <div class="mw-heading mw-heading3"><h3 id="Go">Go</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Pointer_(computer_programming)&amp;action=edit&amp;section=41" title="Edit section: Go"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p><a href="/wiki/Go_(programming_language)" title="Go (programming language)">Go</a> has pointers. Its declaration syntax is equivalent to that of C, but written the other way around, ending with the type. Unlike C, Go has garbage collection, and disallows pointer arithmetic. Reference types, like in C++, do not exist. Some built-in types, like maps and channels, are boxed (i.e. internally they are pointers to mutable structures), and are initialized using the <code>make</code> function. In an approach to unified syntax between pointers and non-pointers, the arrow (<code>-&gt;</code>) operator has been dropped: the dot operator on a pointer refers to the field or method of the dereferenced object. This, however, only works with 1 level of indirection. </p> <div class="mw-heading mw-heading3"><h3 id="Java">Java</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Pointer_(computer_programming)&amp;action=edit&amp;section=42" title="Edit section: Java"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>There is no explicit representation of pointers in <a href="/wiki/Java_(programming_language)" title="Java (programming language)">Java</a>. Instead, more complex data structures like <a href="/wiki/Object-oriented_programming" title="Object-oriented programming">objects</a> and <a href="/wiki/Array_data_structure" class="mw-redirect" title="Array data structure">arrays</a> are implemented using <a href="/wiki/Reference_(computer_science)" title="Reference (computer science)">references</a>. The language does not provide any explicit pointer manipulation operators. It is still possible for code to attempt to dereference a null reference (null pointer), however, which results in a run-time <a href="/wiki/Exception_handling" title="Exception handling">exception</a> being thrown. The space occupied by unreferenced memory objects is recovered automatically by <a href="/wiki/Garbage_collection_(computer_science)" title="Garbage collection (computer science)">garbage collection</a> at run-time.<sup id="cite_ref-21" class="reference"><a href="#cite_note-21"><span class="cite-bracket">&#91;</span>20<span class="cite-bracket">&#93;</span></a></sup> </p> <div class="mw-heading mw-heading3"><h3 id="Modula-2">Modula-2</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Pointer_(computer_programming)&amp;action=edit&amp;section=43" title="Edit section: Modula-2"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>Pointers are implemented very much as in Pascal, as are <code>VAR</code> parameters in procedure calls. <a href="/wiki/Modula-2" title="Modula-2">Modula-2</a> is even more strongly typed than Pascal, with fewer ways to escape the type system. Some of the variants of Modula-2 (such as <a href="/wiki/Modula-3" title="Modula-3">Modula-3</a>) include garbage collection. </p> <div class="mw-heading mw-heading3"><h3 id="Oberon">Oberon</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Pointer_(computer_programming)&amp;action=edit&amp;section=44" title="Edit section: Oberon"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>Much as with Modula-2, pointers are available. There are still fewer ways to evade the type system and so <a href="/wiki/Oberon_(programming_language)" title="Oberon (programming language)">Oberon</a> and its variants are still safer with respect to pointers than Modula-2 or its variants. As with <a href="/wiki/Modula-3" title="Modula-3">Modula-3</a>, garbage collection is a part of the language specification. </p> <div class="mw-heading mw-heading3"><h3 id="Pascal">Pascal</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Pointer_(computer_programming)&amp;action=edit&amp;section=45" title="Edit section: Pascal"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>Unlike many languages that feature pointers, standard <a href="/wiki/International_Organization_for_Standardization" title="International Organization for Standardization">ISO</a> <a href="/wiki/Pascal_(programming_language)" title="Pascal (programming language)">Pascal</a> only allows pointers to reference dynamically created variables that are anonymous and does not allow them to reference standard static or local variables.<sup id="cite_ref-22" class="reference"><a href="#cite_note-22"><span class="cite-bracket">&#91;</span>21<span class="cite-bracket">&#93;</span></a></sup> It does not have pointer arithmetic. Pointers also must have an associated type and a pointer to one type is not compatible with a pointer to another type (e.g. a pointer to a char is not compatible with a pointer to an integer). This helps eliminate the type security issues inherent with other pointer implementations, particularly those used for <a href="/wiki/PL/I" title="PL/I">PL/I</a> or <a href="/wiki/C_(Programming_Language)" class="mw-redirect" title="C (Programming Language)">C</a>. It also removes some risks caused by <a href="/wiki/Dangling_pointers" class="mw-redirect" title="Dangling pointers">dangling pointers</a>, but the ability to dynamically let go of referenced space by using the <code>dispose</code> standard procedure (which has the same effect as the <code>free</code> library function found in <a href="/wiki/C_(Programming_Language)" class="mw-redirect" title="C (Programming Language)">C</a>) means that the risk of dangling pointers has not been entirely eliminated.<sup id="cite_ref-23" class="reference"><a href="#cite_note-23"><span class="cite-bracket">&#91;</span>22<span class="cite-bracket">&#93;</span></a></sup> </p><p>However, in some commercial and open source Pascal (or derivatives) compiler implementations —like <a href="/wiki/Free_Pascal" title="Free Pascal">Free Pascal</a>,<sup id="cite_ref-24" class="reference"><a href="#cite_note-24"><span class="cite-bracket">&#91;</span>23<span class="cite-bracket">&#93;</span></a></sup> <a href="/wiki/Turbo_Pascal" title="Turbo Pascal">Turbo Pascal</a> or the <a href="/wiki/Object_Pascal" title="Object Pascal">Object Pascal</a> in <a href="/wiki/Embarcadero_Delphi" class="mw-redirect" title="Embarcadero Delphi">Embarcadero Delphi</a>— a pointer is allowed to reference standard static or local variables and can be cast from one pointer type to another. Moreover, pointer arithmetic is unrestricted: adding or subtracting from a pointer moves it by that number of bytes in either direction, but using the <code>Inc</code> or <code>Dec</code> standard procedures with it moves the pointer by the size of the <a href="/wiki/Data_type" title="Data type">data type</a> it is <i>declared</i> to point to. An untyped pointer is also provided under the name <code>Pointer</code>, which is compatible with other pointer types. </p> <div class="mw-heading mw-heading3"><h3 id="Perl">Perl</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Pointer_(computer_programming)&amp;action=edit&amp;section=46" title="Edit section: Perl"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>The <a href="/wiki/Perl" title="Perl">Perl</a> <a href="/wiki/Programming_language" title="Programming language">programming language</a> supports pointers, although rarely used, in the form of the pack and unpack functions. These are intended only for simple interactions with compiled OS libraries. In all other cases, Perl uses <a href="/wiki/Reference_(computer_science)" title="Reference (computer science)">references</a>, which are typed and do not allow any form of pointer arithmetic. They are used to construct complex data structures.<sup id="cite_ref-25" class="reference"><a href="#cite_note-25"><span class="cite-bracket">&#91;</span>24<span class="cite-bracket">&#93;</span></a></sup> </p> <div class="mw-heading mw-heading2"><h2 id="See_also">See also</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Pointer_(computer_programming)&amp;action=edit&amp;section=47" title="Edit section: See also"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <style data-mw-deduplicate="TemplateStyles:r1184024115">.mw-parser-output .div-col{margin-top:0.3em;column-width:30em}.mw-parser-output .div-col-small{font-size:90%}.mw-parser-output .div-col-rules{column-rule:1px solid #aaa}.mw-parser-output .div-col dl,.mw-parser-output .div-col ol,.mw-parser-output .div-col ul{margin-top:0}.mw-parser-output .div-col li,.mw-parser-output .div-col dd{page-break-inside:avoid;break-inside:avoid-column}</style><div class="div-col"> <ul><li><a href="/wiki/Address_constant" title="Address constant">Address constant</a></li> <li><a href="/wiki/Bounded_pointer" title="Bounded pointer">Bounded pointer</a></li> <li><a href="/wiki/Buffer_overflow" title="Buffer overflow">Buffer overflow</a></li> <li><a href="/wiki/Cray_pointer" class="mw-redirect" title="Cray pointer">Cray pointer</a></li> <li><a href="/wiki/Fat_pointer" class="mw-redirect" title="Fat pointer">Fat pointer</a></li> <li><a href="/wiki/Function_pointer" title="Function pointer">Function pointer</a></li> <li><a href="/wiki/Hazard_pointer" title="Hazard pointer">Hazard pointer</a></li> <li><a href="/wiki/Iterator" title="Iterator">Iterator</a></li> <li><a href="/wiki/Opaque_pointer" title="Opaque pointer">Opaque pointer</a></li> <li><a href="/wiki/Pointee" class="mw-redirect" title="Pointee">Pointee</a></li> <li><a href="/wiki/Pointer_swizzling" title="Pointer swizzling">Pointer swizzling</a></li> <li><a href="/wiki/Reference_(computer_science)" title="Reference (computer science)">Reference (computer science)</a></li> <li><a href="/wiki/Static_program_analysis" title="Static program analysis">Static program analysis</a></li> <li><a href="/wiki/Storage_violation" title="Storage violation">Storage violation</a></li> <li><a href="/wiki/Tagged_pointer" title="Tagged pointer">Tagged pointer</a></li> <li><a href="/wiki/Variable_(computer_science)" title="Variable (computer science)">Variable (computer science)</a></li> <li><a href="/wiki/Zero-based_numbering" title="Zero-based numbering">Zero-based numbering</a></li></ul> </div> <div class="mw-heading mw-heading2"><h2 id="Notes">Notes</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Pointer_(computer_programming)&amp;action=edit&amp;section=48" title="Edit section: Notes"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <style data-mw-deduplicate="TemplateStyles:r1239543626">.mw-parser-output .reflist{margin-bottom:0.5em;list-style-type:decimal}@media screen{.mw-parser-output .reflist{font-size:90%}}.mw-parser-output .reflist .references{font-size:100%;margin-bottom:0;list-style-type:inherit}.mw-parser-output .reflist-columns-2{column-width:30em}.mw-parser-output .reflist-columns-3{column-width:25em}.mw-parser-output .reflist-columns{margin-top:0.3em}.mw-parser-output .reflist-columns ol{margin-top:0}.mw-parser-output .reflist-columns li{page-break-inside:avoid;break-inside:avoid-column}.mw-parser-output .reflist-upper-alpha{list-style-type:upper-alpha}.mw-parser-output .reflist-upper-roman{list-style-type:upper-roman}.mw-parser-output .reflist-lower-alpha{list-style-type:lower-alpha}.mw-parser-output .reflist-lower-greek{list-style-type:lower-greek}.mw-parser-output .reflist-lower-roman{list-style-type:lower-roman}</style><div class="reflist reflist-lower-alpha"> <div class="mw-references-wrap"><ol class="references"> <li id="cite_note-16"><span class="mw-cite-backlink"><b><a href="#cite_ref-16">^</a></b></span> <span class="reference-text">Some compilers allow storing the addresses of functions in void pointers. The C++ standard lists converting a function pointer to <code>void*</code> as a conditionally supported feature and the C standard says such conversions are "common extensions". This is required by the <a href="/wiki/POSIX" title="POSIX">POSIX</a> function <code>dlsym</code>.<sup id="cite_ref-15" class="reference"><a href="#cite_note-15"><span class="cite-bracket">&#91;</span>15<span class="cite-bracket">&#93;</span></a></sup></span> </li> </ol></div></div> <div class="mw-heading mw-heading2"><h2 id="References">References</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Pointer_(computer_programming)&amp;action=edit&amp;section=49" title="Edit section: References"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1239543626" /><div class="reflist"> <div class="mw-references-wrap mw-references-columns"><ol class="references"> <li id="cite_note-1"><span class="mw-cite-backlink"><b><a href="#cite_ref-1">^</a></b></span> <span class="reference-text"><style data-mw-deduplicate="TemplateStyles:r1238218222">.mw-parser-output cite.citation{font-style:inherit;word-wrap:break-word}.mw-parser-output .citation q{quotes:"\"""\"""'""'"}.mw-parser-output .citation:target{background-color:rgba(0,127,255,0.133)}.mw-parser-output .id-lock-free.id-lock-free a{background:url("//upload.wikimedia.org/wikipedia/commons/6/65/Lock-green.svg")right 0.1em center/9px no-repeat}.mw-parser-output .id-lock-limited.id-lock-limited a,.mw-parser-output .id-lock-registration.id-lock-registration a{background:url("//upload.wikimedia.org/wikipedia/commons/d/d6/Lock-gray-alt-2.svg")right 0.1em center/9px no-repeat}.mw-parser-output .id-lock-subscription.id-lock-subscription a{background:url("//upload.wikimedia.org/wikipedia/commons/a/aa/Lock-red-alt-2.svg")right 0.1em center/9px no-repeat}.mw-parser-output .cs1-ws-icon a{background:url("//upload.wikimedia.org/wikipedia/commons/4/4c/Wikisource-logo.svg")right 0.1em center/12px no-repeat}body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-free a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-limited a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-registration a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-subscription a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .cs1-ws-icon a{background-size:contain;padding:0 1em 0 0}.mw-parser-output .cs1-code{color:inherit;background:inherit;border:none;padding:inherit}.mw-parser-output .cs1-hidden-error{display:none;color:var(--color-error,#d33)}.mw-parser-output .cs1-visible-error{color:var(--color-error,#d33)}.mw-parser-output .cs1-maint{display:none;color:#085;margin-left:0.3em}.mw-parser-output .cs1-kern-left{padding-left:0.2em}.mw-parser-output .cs1-kern-right{padding-right:0.2em}.mw-parser-output .citation .mw-selflink{font-weight:inherit}@media screen{.mw-parser-output .cs1-format{font-size:95%}html.skin-theme-clientpref-night .mw-parser-output .cs1-maint{color:#18911f}}@media screen and (prefers-color-scheme:dark){html.skin-theme-clientpref-os .mw-parser-output .cs1-maint{color:#18911f}}</style><cite id="CITEREFDonald_Knuth1974" class="citation journal cs1"><a href="/wiki/Donald_Knuth" title="Donald Knuth">Donald Knuth</a> (1974). <a rel="nofollow" class="external text" href="https://web.archive.org/web/20090824073244/http://pplab.snu.ac.kr/courses/adv_pl05/papers/p261-knuth.pdf">"Structured Programming with go to Statements"</a> <span class="cs1-format">(PDF)</span>. <i>Computing Surveys</i>. <b>6</b> (5): <span class="nowrap">261–</span>301. <a href="/wiki/CiteSeerX_(identifier)" class="mw-redirect" title="CiteSeerX (identifier)">CiteSeerX</a>&#160;<span class="id-lock-free" title="Freely accessible"><a rel="nofollow" class="external text" href="https://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.103.6084">10.1.1.103.6084</a></span>. <a href="/wiki/Doi_(identifier)" class="mw-redirect" title="Doi (identifier)">doi</a>:<a rel="nofollow" class="external text" href="https://doi.org/10.1145%2F356635.356640">10.1145/356635.356640</a>. <a href="/wiki/S2CID_(identifier)" class="mw-redirect" title="S2CID (identifier)">S2CID</a>&#160;<a rel="nofollow" class="external text" href="https://api.semanticscholar.org/CorpusID:207630080">207630080</a>. Archived from <a rel="nofollow" class="external text" href="http://pplab.snu.ac.kr/courses/adv_pl05/papers/p261-knuth.pdf">the original</a> <span class="cs1-format">(PDF)</span> on August 24, 2009.</cite><span title="ctx_ver=Z39.88-2004&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Ajournal&amp;rft.genre=article&amp;rft.jtitle=Computing+Surveys&amp;rft.atitle=Structured+Programming+with+go+to+Statements&amp;rft.volume=6&amp;rft.issue=5&amp;rft.pages=%3Cspan+class%3D%22nowrap%22%3E261-%3C%2Fspan%3E301&amp;rft.date=1974&amp;rft_id=https%3A%2F%2Fciteseerx.ist.psu.edu%2Fviewdoc%2Fsummary%3Fdoi%3D10.1.1.103.6084%23id-name%3DCiteSeerX&amp;rft_id=https%3A%2F%2Fapi.semanticscholar.org%2FCorpusID%3A207630080%23id-name%3DS2CID&amp;rft_id=info%3Adoi%2F10.1145%2F356635.356640&amp;rft.au=Donald+Knuth&amp;rft_id=http%3A%2F%2Fpplab.snu.ac.kr%2Fcourses%2Fadv_pl05%2Fpapers%2Fp261-knuth.pdf&amp;rfr_id=info%3Asid%2Fen.wikipedia.org%3APointer+%28computer+programming%29" class="Z3988"></span></span> </li> <li id="cite_note-2"><span class="mw-cite-backlink"><b><a href="#cite_ref-2">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222" /><cite id="CITEREFReilly2003" class="citation book cs1">Reilly, Edwin D. (2003). <span class="id-lock-registration" title="Free registration required"><a rel="nofollow" class="external text" href="https://archive.org/details/milestonesincomp0000reil"><i>Milestones in Computer Science and Information Technology</i></a></span>. Greenwood Publishing Group. p.&#160;<a rel="nofollow" class="external text" href="https://archive.org/details/milestonesincomp0000reil/page/204">204</a>. <a href="/wiki/ISBN_(identifier)" class="mw-redirect" title="ISBN (identifier)">ISBN</a>&#160;<a href="/wiki/Special:BookSources/9781573565219" title="Special:BookSources/9781573565219"><bdi>9781573565219</bdi></a><span class="reference-accessdate">. Retrieved <span class="nowrap">2018-04-13</span></span>. <q>Harold Lawson pointer.</q></cite><span title="ctx_ver=Z39.88-2004&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&amp;rft.genre=book&amp;rft.btitle=Milestones+in+Computer+Science+and+Information+Technology&amp;rft.pages=204&amp;rft.pub=Greenwood+Publishing+Group&amp;rft.date=2003&amp;rft.isbn=9781573565219&amp;rft.aulast=Reilly&amp;rft.aufirst=Edwin+D.&amp;rft_id=https%3A%2F%2Farchive.org%2Fdetails%2Fmilestonesincomp0000reil&amp;rfr_id=info%3Asid%2Fen.wikipedia.org%3APointer+%28computer+programming%29" class="Z3988"></span></span> </li> <li id="cite_note-3"><span class="mw-cite-backlink"><b><a href="#cite_ref-3">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222" /><cite class="citation web cs1"><a rel="nofollow" class="external text" href="https://web.archive.org/web/20110322221848/http://awards.computer.org/ana/award/viewPastRecipients.action?id=13">"IEEE Computer Society awards list"</a>. Awards.computer.org. Archived from <a rel="nofollow" class="external text" href="http://awards.computer.org/ana/award/viewPastRecipients.action?id=13">the original</a> on 2011-03-22<span class="reference-accessdate">. Retrieved <span class="nowrap">2018-04-13</span></span>.</cite><span title="ctx_ver=Z39.88-2004&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&amp;rft.genre=unknown&amp;rft.btitle=IEEE+Computer+Society+awards+list&amp;rft.pub=Awards.computer.org&amp;rft_id=http%3A%2F%2Fawards.computer.org%2Fana%2Faward%2FviewPastRecipients.action%3Fid%3D13&amp;rfr_id=info%3Asid%2Fen.wikipedia.org%3APointer+%28computer+programming%29" class="Z3988"></span></span> </li> <li id="cite_note-4"><span class="mw-cite-backlink"><b><a href="#cite_ref-4">^</a></b></span> <span class="reference-text"><a href="#c-std">ISO/IEC 9899</a>, clause 6.7.5.1, paragraph 1.</span> </li> <li id="cite_note-5"><span class="mw-cite-backlink"><b><a href="#cite_ref-5">^</a></b></span> <span class="reference-text"><a href="#c-std">ISO/IEC 9899</a>, clause 6.7.8, paragraph 10.</span> </li> <li id="cite_note-c-NULL-6"><span class="mw-cite-backlink"><b><a href="#cite_ref-c-NULL_6-0">^</a></b></span> <span class="reference-text"><a href="#c-std">ISO/IEC 9899</a>, clause 7.17, paragraph 3: <i>NULL... which expands to an implementation-defined null pointer constant...</i></span> </li> <li id="cite_note-7"><span class="mw-cite-backlink"><b><a href="#cite_ref-7">^</a></b></span> <span class="reference-text"><a href="#c-std">ISO/IEC 9899</a>, clause 6.5.3.2, paragraph 4, footnote 87: <i>If an invalid value has been assigned to the pointer, the behavior of the unary * operator is undefined... Among the invalid values for dereferencing a pointer by the unary * operator are a null pointer...</i></span> </li> <li id="cite_note-Plauger1992-8"><span class="mw-cite-backlink">^ <a href="#cite_ref-Plauger1992_8-0"><sup><i><b>a</b></i></sup></a> <a href="#cite_ref-Plauger1992_8-1"><sup><i><b>b</b></i></sup></a></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222" /><cite id="CITEREFPlaugerBrodie,_Jim1992" class="citation book cs1"><a href="/wiki/P._J._Plauger" title="P. J. Plauger">Plauger, P J</a>; Brodie, Jim (1992). <span class="id-lock-registration" title="Free registration required"><a rel="nofollow" class="external text" href="https://archive.org/details/ansiisostandardc00plau/page/108"><i>ANSI and ISO Standard C Programmer's Reference</i></a></span>. Redmond, WA: Microsoft Press. pp.&#160;<a rel="nofollow" class="external text" href="https://archive.org/details/ansiisostandardc00plau/page/108">108, 51</a>. <a href="/wiki/ISBN_(identifier)" class="mw-redirect" title="ISBN (identifier)">ISBN</a>&#160;<a href="/wiki/Special:BookSources/978-1-55615-359-4" title="Special:BookSources/978-1-55615-359-4"><bdi>978-1-55615-359-4</bdi></a>. <q>An array type does not contain additional holes because all other types pack tightly when composed into arrays <i>[at page 51]</i></q></cite><span title="ctx_ver=Z39.88-2004&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&amp;rft.genre=book&amp;rft.btitle=ANSI+and+ISO+Standard+C+Programmer%27s+Reference&amp;rft.place=Redmond%2C+WA&amp;rft.pages=108%2C+51&amp;rft.pub=Microsoft+Press&amp;rft.date=1992&amp;rft.isbn=978-1-55615-359-4&amp;rft.aulast=Plauger&amp;rft.aufirst=P+J&amp;rft.au=Brodie%2C+Jim&amp;rft_id=https%3A%2F%2Farchive.org%2Fdetails%2Fansiisostandardc00plau%2Fpage%2F108&amp;rfr_id=info%3Asid%2Fen.wikipedia.org%3APointer+%28computer+programming%29" class="Z3988"></span></span> </li> <li id="cite_note-9"><span class="mw-cite-backlink"><b><a href="#cite_ref-9">^</a></b></span> <span class="reference-text"><a rel="nofollow" class="external text" href="http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1124.pdf">WG14 N1124</a>, <a rel="nofollow" class="external text" href="http://www.open-std.org/jtc1/sc22/wg14/www/standards.html">C – Approved standards: ISO/IEC 9899 – Programming languages – C</a>, 2005-05-06.</span> </li> <li id="cite_note-10"><span class="mw-cite-backlink"><b><a href="#cite_ref-10">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222" /><cite id="CITEREFJung" class="citation web cs1">Jung, Ralf. <a rel="nofollow" class="external text" href="https://www.ralfj.de/blog/2020/12/14/provenance.html">"Pointers Are Complicated II, or: We need better language specs"</a>.</cite><span title="ctx_ver=Z39.88-2004&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&amp;rft.genre=unknown&amp;rft.btitle=Pointers+Are+Complicated+II%2C+or%3A+We+need+better+language+specs&amp;rft.aulast=Jung&amp;rft.aufirst=Ralf&amp;rft_id=https%3A%2F%2Fwww.ralfj.de%2Fblog%2F2020%2F12%2F14%2Fprovenance.html&amp;rfr_id=info%3Asid%2Fen.wikipedia.org%3APointer+%28computer+programming%29" class="Z3988"></span></span> </li> <li id="cite_note-11"><span class="mw-cite-backlink"><b><a href="#cite_ref-11">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222" /><cite id="CITEREFJung" class="citation web cs1">Jung, Ralf. <a rel="nofollow" class="external text" href="https://www.ralfj.de/blog/2018/07/24/pointers-and-bytes.html">"Pointers Are Complicated, or: What's in a Byte?"</a>.</cite><span title="ctx_ver=Z39.88-2004&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&amp;rft.genre=unknown&amp;rft.btitle=Pointers+Are+Complicated%2C+or%3A+What%27s+in+a+Byte%3F&amp;rft.aulast=Jung&amp;rft.aufirst=Ralf&amp;rft_id=https%3A%2F%2Fwww.ralfj.de%2Fblog%2F2018%2F07%2F24%2Fpointers-and-bytes.html&amp;rfr_id=info%3Asid%2Fen.wikipedia.org%3APointer+%28computer+programming%29" class="Z3988"></span></span> </li> <li id="cite_note-12"><span class="mw-cite-backlink"><b><a href="#cite_ref-12">^</a></b></span> <span class="reference-text"><style data-mw-deduplicate="TemplateStyles:r1041539562">.mw-parser-output .citation{word-wrap:break-word}.mw-parser-output .citation:target{background-color:rgba(0,127,255,0.133)}</style><span class="citation patent" id="CITEREFSteiner,_Robert_C._(Broomfield,_CO)2003"><a rel="nofollow" class="external text" href="https://worldwide.espacenet.com/textdoc?DB=EPODOC&amp;IDX=us6625718">us&#32;patent 6625718</a>,&#32;Steiner, Robert C. (Broomfield, CO),&#32;"Pointers that are relative to their own present locations",&#32;issued 2003-09-23,&#32; assigned to Avaya Technology Corp. (Basking Ridge, NJ)</span><span class="Z3988" title="ctx_ver=Z39.88-2004&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Apatent&amp;rft.number=6625718&amp;rft.cc=us&amp;rft.title=Pointers+that+are+relative+to+their+own+present+locations&amp;rft.inventor=Steiner%2C+Robert+C.+%28Broomfield%2C+CO%29&amp;rft.assignee=Avaya+Technology+Corp.+%28Basking+Ridge%2C+NJ%29&amp;rft.date=2003-09-23&amp;rft.appldate=1998-02-05"><span style="display: none;">&#160;</span></span></span> </li> <li id="cite_note-13"><span class="mw-cite-backlink"><b><a href="#cite_ref-13">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1041539562" /><span class="citation patent" id="CITEREFNagy,_Michael_(Tampa,_FL)2000"><a rel="nofollow" class="external text" href="https://worldwide.espacenet.com/textdoc?DB=EPODOC&amp;IDX=us6115721">us&#32;patent 6115721</a>,&#32;Nagy, Michael (Tampa, FL),&#32;"System and method for database save and restore using self-pointers",&#32;issued 2000-09-05,&#32; assigned to IBM (Armonk, NY)</span><span class="Z3988" title="ctx_ver=Z39.88-2004&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Apatent&amp;rft.number=6115721&amp;rft.cc=us&amp;rft.title=System+and+method+for+database+save+and+restore+using+self-pointers&amp;rft.inventor=Nagy%2C+Michael+%28Tampa%2C+FL%29&amp;rft.assignee=IBM+%28Armonk%2C+NY%29&amp;rft.date=2000-09-05&amp;rft.appldate=1998-06-23"><span style="display: none;">&#160;</span></span></span> </li> <li id="cite_note-14"><span class="mw-cite-backlink"><b><a href="#cite_ref-14">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222" /><cite class="citation web cs1"><a rel="nofollow" class="external text" href="http://msdn.microsoft.com/en-us/library/57a97k4e.aspx">"Based Pointers"</a>. Msdn.microsoft.com<span class="reference-accessdate">. Retrieved <span class="nowrap">2018-04-13</span></span>.</cite><span title="ctx_ver=Z39.88-2004&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&amp;rft.genre=unknown&amp;rft.btitle=Based+Pointers&amp;rft.pub=Msdn.microsoft.com&amp;rft_id=http%3A%2F%2Fmsdn.microsoft.com%2Fen-us%2Flibrary%2F57a97k4e.aspx&amp;rfr_id=info%3Asid%2Fen.wikipedia.org%3APointer+%28computer+programming%29" class="Z3988"></span></span> </li> <li id="cite_note-15"><span class="mw-cite-backlink"><b><a href="#cite_ref-15">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222" /><cite class="citation web cs1"><a rel="nofollow" class="external text" href="https://cplusplus.github.io/CWG/issues/195.html">"CWG Issue 195"</a>. <i>cplusplus.github.io</i><span class="reference-accessdate">. Retrieved <span class="nowrap">2024-02-15</span></span>.</cite><span title="ctx_ver=Z39.88-2004&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Ajournal&amp;rft.genre=unknown&amp;rft.jtitle=cplusplus.github.io&amp;rft.atitle=CWG+Issue+195&amp;rft_id=https%3A%2F%2Fcplusplus.github.io%2FCWG%2Fissues%2F195.html&amp;rfr_id=info%3Asid%2Fen.wikipedia.org%3APointer+%28computer+programming%29" class="Z3988"></span></span> </li> <li id="cite_note-17"><span class="mw-cite-backlink"><b><a href="#cite_ref-17">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222" /><cite class="citation web cs1"><a rel="nofollow" class="external text" href="https://isocpp.org/wiki/faq/pointers-to-members">"Pointers to Member Functions"</a>. isocpp.org<span class="reference-accessdate">. Retrieved <span class="nowrap">2022-11-26</span></span>.</cite><span title="ctx_ver=Z39.88-2004&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&amp;rft.genre=unknown&amp;rft.btitle=Pointers+to+Member+Functions&amp;rft.pub=isocpp.org&amp;rft_id=https%3A%2F%2Fisocpp.org%2Fwiki%2Ffaq%2Fpointers-to-members&amp;rfr_id=info%3Asid%2Fen.wikipedia.org%3APointer+%28computer+programming%29" class="Z3988"></span></span> </li> <li id="cite_note-18"><span class="mw-cite-backlink"><b><a href="#cite_ref-18">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222" /><cite class="citation web cs1"><a rel="nofollow" class="external text" href="https://linux.die.net/man/1/c++filt">"c++filt(1) - Linux man page"</a>.</cite><span title="ctx_ver=Z39.88-2004&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&amp;rft.genre=unknown&amp;rft.btitle=c%2B%2Bfilt%281%29+-+Linux+man+page&amp;rft_id=https%3A%2F%2Flinux.die.net%2Fman%2F1%2Fc%2B%2Bfilt&amp;rfr_id=info%3Asid%2Fen.wikipedia.org%3APointer+%28computer+programming%29" class="Z3988"></span></span> </li> <li id="cite_note-19"><span class="mw-cite-backlink"><b><a href="#cite_ref-19">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222" /><cite class="citation web cs1"><a rel="nofollow" class="external text" href="http://refspecs.linux-foundation.org/cxxabi-1.83.html#mangling">"Itanium C++ ABI"</a>.</cite><span title="ctx_ver=Z39.88-2004&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&amp;rft.genre=unknown&amp;rft.btitle=Itanium+C%2B%2B+ABI&amp;rft_id=http%3A%2F%2Frefspecs.linux-foundation.org%2Fcxxabi-1.83.html%23mangling&amp;rfr_id=info%3Asid%2Fen.wikipedia.org%3APointer+%28computer+programming%29" class="Z3988"></span></span> </li> <li id="cite_note-20"><span class="mw-cite-backlink"><b><a href="#cite_ref-20">^</a></b></span> <span class="reference-text">Ulf Bilting, Jan Skansholm, "Vägen till C" (the Road to C), third edition, page 169, <link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222" /><a href="/wiki/ISBN_(identifier)" class="mw-redirect" title="ISBN (identifier)">ISBN</a>&#160;<a href="/wiki/Special:BookSources/91-44-01468-6" title="Special:BookSources/91-44-01468-6">91-44-01468-6</a></span> </li> <li id="cite_note-21"><span class="mw-cite-backlink"><b><a href="#cite_ref-21">^</a></b></span> <span class="reference-text">Nick Parlante, <a rel="nofollow" class="external autonumber" href="http://cslibrary.stanford.edu/102/PointersAndMemory.pdf#%22Pointers%20and%20Memory%22">[1]</a>, <a rel="nofollow" class="external text" href="http://cslibrary.stanford.edu#">Stanford Computer Science Education Library</a>, pp. 9–10 (2000).</span> </li> <li id="cite_note-22"><span class="mw-cite-backlink"><b><a href="#cite_ref-22">^</a></b></span> <span class="reference-text">ISO 7185 Pascal Standard (unofficial copy), section <a rel="nofollow" class="external text" href="http://standardpascal.org/iso7185.html#6.4.4%20Pointer-types">6.4.4 Pointer-types</a> <a rel="nofollow" class="external text" href="https://web.archive.org/web/20170424183023/http://www.standardpascal.org/iso7185.html#6.4.4%20Pointer-types">Archived</a> 2017-04-24 at the <a href="/wiki/Wayback_Machine" title="Wayback Machine">Wayback Machine</a> and subsequent.</span> </li> <li id="cite_note-23"><span class="mw-cite-backlink"><b><a href="#cite_ref-23">^</a></b></span> <span class="reference-text">J. Welsh, W. J. Sneeringer, and C. A. R. Hoare, "Ambiguities and Insecurities in Pascal," <i>Software: Practice and Experience 7</i>, pp. 685–696 (1977)</span> </li> <li id="cite_note-24"><span class="mw-cite-backlink"><b><a href="#cite_ref-24">^</a></b></span> <span class="reference-text">Free Pascal Language Reference guide, section <a rel="nofollow" class="external text" href="http://www.freepascal.org/docs-html/ref/refse15.html#x43-490003.4">3.4 Pointers</a></span> </li> <li id="cite_note-25"><span class="mw-cite-backlink"><b><a href="#cite_ref-25">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222" /><cite id="CITEREFContact_details" class="citation web cs1">Contact details. <a rel="nofollow" class="external text" href="http://perldoc.perl.org/perlref.html#Making-References">"// Making References (Perl References and nested data structures)"</a>. Perldoc.perl.org<span class="reference-accessdate">. Retrieved <span class="nowrap">2018-04-13</span></span>.</cite><span title="ctx_ver=Z39.88-2004&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&amp;rft.genre=unknown&amp;rft.btitle=%2F%2F+Making+References+%28Perl+References+and+nested+data+structures%29&amp;rft.pub=Perldoc.perl.org&amp;rft.au=Contact+details&amp;rft_id=http%3A%2F%2Fperldoc.perl.org%2Fperlref.html%23Making-References&amp;rfr_id=info%3Asid%2Fen.wikipedia.org%3APointer+%28computer+programming%29" class="Z3988"></span></span> </li> </ol></div></div> <div class="mw-heading mw-heading2"><h2 id="External_links">External links</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Pointer_(computer_programming)&amp;action=edit&amp;section=50" title="Edit section: External links"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <style data-mw-deduplicate="TemplateStyles:r1235681985">.mw-parser-output .side-box{margin:4px 0;box-sizing:border-box;border:1px solid #aaa;font-size:88%;line-height:1.25em;background-color:var(--background-color-interactive-subtle,#f8f9fa);display:flow-root}.mw-parser-output .side-box-abovebelow,.mw-parser-output .side-box-text{padding:0.25em 0.9em}.mw-parser-output .side-box-image{padding:2px 0 2px 0.9em;text-align:center}.mw-parser-output .side-box-imageright{padding:2px 0.9em 2px 0;text-align:center}@media(min-width:500px){.mw-parser-output .side-box-flex{display:flex;align-items:center}.mw-parser-output .side-box-text{flex:1;min-width:0}}@media(min-width:720px){.mw-parser-output .side-box{width:238px}.mw-parser-output .side-box-right{clear:right;float:right;margin-left:1em}.mw-parser-output .side-box-left{margin-right:1em}}</style><style data-mw-deduplicate="TemplateStyles:r1237033735">@media print{body.ns-0 .mw-parser-output .sistersitebox{display:none!important}}@media screen{html.skin-theme-clientpref-night .mw-parser-output .sistersitebox img[src*="Wiktionary-logo-en-v2.svg"]{background-color:white}}@media screen and (prefers-color-scheme:dark){html.skin-theme-clientpref-os .mw-parser-output .sistersitebox img[src*="Wiktionary-logo-en-v2.svg"]{background-color:white}}</style><div class="side-box side-box-right plainlinks sistersitebox"><style data-mw-deduplicate="TemplateStyles:r1126788409">.mw-parser-output .plainlist ol,.mw-parser-output .plainlist ul{line-height:inherit;list-style:none;margin:0;padding:0}.mw-parser-output .plainlist ol li,.mw-parser-output .plainlist ul li{margin-bottom:0}</style> <div class="side-box-flex"> <div class="side-box-image"><span class="noviewer" typeof="mw:File"><a href="/wiki/File:Commons-logo.svg" class="mw-file-description"><img alt="" src="//upload.wikimedia.org/wikipedia/en/thumb/4/4a/Commons-logo.svg/40px-Commons-logo.svg.png" decoding="async" width="30" height="40" class="mw-file-element" srcset="//upload.wikimedia.org/wikipedia/en/thumb/4/4a/Commons-logo.svg/60px-Commons-logo.svg.png 1.5x" data-file-width="1024" data-file-height="1376" /></a></span></div> <div class="side-box-text plainlist">Wikimedia Commons has media related to <span style="font-weight: bold; font-style: italic;"><a href="https://commons.wikimedia.org/wiki/Category:Pointers_(computing)" class="extiw" title="commons:Category:Pointers (computing)">Pointers (computing)</a></span>.</div></div> </div> <link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1235681985" /><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1237033735" /><div class="side-box side-box-right plainlinks sistersitebox"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1126788409" /> <div class="side-box-flex"> <div class="side-box-image"><span class="noviewer" typeof="mw:File"><a href="/wiki/File:Wikiversity_logo_2017.svg" class="mw-file-description"><img alt="" src="//upload.wikimedia.org/wikipedia/commons/thumb/0/0b/Wikiversity_logo_2017.svg/40px-Wikiversity_logo_2017.svg.png" decoding="async" width="40" height="33" class="mw-file-element" srcset="//upload.wikimedia.org/wikipedia/commons/thumb/0/0b/Wikiversity_logo_2017.svg/60px-Wikiversity_logo_2017.svg.png 1.5x, //upload.wikimedia.org/wikipedia/commons/thumb/0/0b/Wikiversity_logo_2017.svg/80px-Wikiversity_logo_2017.svg.png 2x" data-file-width="626" data-file-height="512" /></a></span></div> <div class="side-box-text plainlist">Wikiversity has learning resources about <i><b><a href="https://en.wikiversity.org/wiki/Pointers" class="extiw" title="v:Pointers">Pointers</a></b></i></div></div> </div> <link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1235681985" /><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1237033735" /><div class="side-box side-box-right plainlinks sistersitebox"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1126788409" /> <div class="side-box-flex"> <div class="side-box-image"><span class="noviewer" typeof="mw:File"><a href="/wiki/File:Wikibooks-logo-en-noslogan.svg" class="mw-file-description"><img alt="" src="//upload.wikimedia.org/wikipedia/commons/thumb/d/df/Wikibooks-logo-en-noslogan.svg/40px-Wikibooks-logo-en-noslogan.svg.png" decoding="async" width="40" height="40" class="mw-file-element" srcset="//upload.wikimedia.org/wikipedia/commons/thumb/d/df/Wikibooks-logo-en-noslogan.svg/60px-Wikibooks-logo-en-noslogan.svg.png 1.5x, //upload.wikimedia.org/wikipedia/commons/thumb/d/df/Wikibooks-logo-en-noslogan.svg/80px-Wikibooks-logo-en-noslogan.svg.png 2x" data-file-width="400" data-file-height="400" /></a></span></div> <div class="side-box-text plainlist">The Wikibook <i><a href="https://en.wikibooks.org/wiki/C_Programming" class="extiw" title="wikibooks:C Programming">C Programming</a></i> has a page on the topic of: <i><b><a href="https://en.wikibooks.org/wiki/C_Programming/Pointers" class="extiw" title="wikibooks:C Programming/Pointers">Pointers</a></b></i></div></div> </div> <ul><li><a rel="nofollow" class="external text" href="https://www.researchgate.net/publication/220424487_PLI_list_processing">PL/I List Processing</a> Paper from the June, 1967 issue of CACM</li> <li><a rel="nofollow" class="external text" href="https://cdecl.org">cdecl.org</a> A tool to convert pointer declarations to plain English</li> <li><a rel="nofollow" class="external text" href="https://overiq.com/c-programming-101/pointer-basics-in-c/">Over IQ.com</a> A beginner level guide describing pointers in a plain English.</li> <li><a rel="nofollow" class="external text" href="http://cslibrary.stanford.edu/">Pointers and Memory</a> Introduction to pointers – Stanford Computer Science Education Library</li> <li><a rel="nofollow" class="external text" href="http://www.onlinecomputerteacher.net/pointers-in-c.html">Pointers in C programming</a> <a rel="nofollow" class="external text" href="https://web.archive.org/web/20190609120644/http://www.onlinecomputerteacher.net/pointers-in-c.html">Archived</a> 2019-06-09 at the <a href="/wiki/Wayback_Machine" title="Wayback Machine">Wayback Machine</a> A visual model for beginner C programmiers</li> <li><a rel="nofollow" class="external text" href="http://0pointer.de/">0pointer.de</a> A terse list of minimum length source codes that dereference a null pointer in several different programming languages</li> <li><a rel="nofollow" class="external text" href="https://publications.gbdirect.co.uk/c_book/chapter5/pointers.html">"The C book" – containing pointer examples in ANSI C</a></li> <li><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222" /><cite id="c-std" class="citation book cs1">Joint Technical Committee ISO/IEC JTC 1, Subcommittee SC 22, Working Group WG 14 (2007-09-08). <a rel="nofollow" class="external text" href="http://www.open-std.org/jtc1/sc22/WG14/www/docs/n1256.pdf"><i>International Standard ISO/IEC 9899</i></a> <span class="cs1-format">(PDF)</span>.</cite><span title="ctx_ver=Z39.88-2004&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&amp;rft.genre=book&amp;rft.btitle=International+Standard+ISO%2FIEC+9899&amp;rft.date=2007-09-08&amp;rft.au=Joint+Technical+Committee+ISO%2FIEC+JTC+1%2C+Subcommittee+SC+22%2C+Working+Group+WG+14&amp;rft_id=http%3A%2F%2Fwww.open-std.org%2Fjtc1%2Fsc22%2FWG14%2Fwww%2Fdocs%2Fn1256.pdf&amp;rfr_id=info%3Asid%2Fen.wikipedia.org%3APointer+%28computer+programming%29" class="Z3988"></span><span class="cs1-maint citation-comment"><code class="cs1-code">{{<a href="/wiki/Template:Cite_book" title="Template:Cite book">cite book</a>}}</code>: CS1 maint: multiple names: authors list (<a href="/wiki/Category:CS1_maint:_multiple_names:_authors_list" title="Category:CS1 maint: multiple names: authors list">link</a>) CS1 maint: numeric names: authors list (<a href="/wiki/Category:CS1_maint:_numeric_names:_authors_list" title="Category:CS1 maint: numeric names: authors list">link</a>)</span> Committee draft.</li></ul> <div class="navbox-styles"><style data-mw-deduplicate="TemplateStyles:r1129693374">.mw-parser-output .hlist dl,.mw-parser-output .hlist ol,.mw-parser-output .hlist ul{margin:0;padding:0}.mw-parser-output .hlist dd,.mw-parser-output .hlist dt,.mw-parser-output .hlist li{margin:0;display:inline}.mw-parser-output .hlist.inline,.mw-parser-output .hlist.inline dl,.mw-parser-output .hlist.inline ol,.mw-parser-output .hlist.inline ul,.mw-parser-output .hlist dl dl,.mw-parser-output .hlist dl ol,.mw-parser-output .hlist dl ul,.mw-parser-output .hlist ol dl,.mw-parser-output .hlist ol ol,.mw-parser-output .hlist ol ul,.mw-parser-output .hlist ul dl,.mw-parser-output .hlist ul ol,.mw-parser-output .hlist ul ul{display:inline}.mw-parser-output .hlist .mw-empty-li{display:none}.mw-parser-output .hlist dt::after{content:": "}.mw-parser-output .hlist dd::after,.mw-parser-output .hlist li::after{content:" · ";font-weight:bold}.mw-parser-output .hlist dd:last-child::after,.mw-parser-output .hlist dt:last-child::after,.mw-parser-output .hlist li:last-child::after{content:none}.mw-parser-output .hlist dd dd:first-child::before,.mw-parser-output .hlist dd dt:first-child::before,.mw-parser-output .hlist dd li:first-child::before,.mw-parser-output .hlist dt dd:first-child::before,.mw-parser-output .hlist dt dt:first-child::before,.mw-parser-output .hlist dt li:first-child::before,.mw-parser-output .hlist li dd:first-child::before,.mw-parser-output .hlist li dt:first-child::before,.mw-parser-output .hlist li li:first-child::before{content:" (";font-weight:normal}.mw-parser-output .hlist dd dd:last-child::after,.mw-parser-output .hlist dd dt:last-child::after,.mw-parser-output .hlist dd li:last-child::after,.mw-parser-output .hlist dt dd:last-child::after,.mw-parser-output .hlist dt dt:last-child::after,.mw-parser-output .hlist dt li:last-child::after,.mw-parser-output .hlist li dd:last-child::after,.mw-parser-output .hlist li dt:last-child::after,.mw-parser-output .hlist li li:last-child::after{content:")";font-weight:normal}.mw-parser-output .hlist ol{counter-reset:listitem}.mw-parser-output .hlist ol>li{counter-increment:listitem}.mw-parser-output .hlist ol>li::before{content:" "counter(listitem)"\a0 "}.mw-parser-output .hlist dd ol>li:first-child::before,.mw-parser-output .hlist dt ol>li:first-child::before,.mw-parser-output .hlist li ol>li:first-child::before{content:" ("counter(listitem)"\a0 "}</style><style data-mw-deduplicate="TemplateStyles:r1236075235">.mw-parser-output .navbox{box-sizing:border-box;border:1px solid #a2a9b1;width:100%;clear:both;font-size:88%;text-align:center;padding:1px;margin:1em auto 0}.mw-parser-output .navbox .navbox{margin-top:0}.mw-parser-output .navbox+.navbox,.mw-parser-output .navbox+.navbox-styles+.navbox{margin-top:-1px}.mw-parser-output .navbox-inner,.mw-parser-output .navbox-subgroup{width:100%}.mw-parser-output .navbox-group,.mw-parser-output .navbox-title,.mw-parser-output .navbox-abovebelow{padding:0.25em 1em;line-height:1.5em;text-align:center}.mw-parser-output .navbox-group{white-space:nowrap;text-align:right}.mw-parser-output .navbox,.mw-parser-output .navbox-subgroup{background-color:#fdfdfd}.mw-parser-output .navbox-list{line-height:1.5em;border-color:#fdfdfd}.mw-parser-output .navbox-list-with-group{text-align:left;border-left-width:2px;border-left-style:solid}.mw-parser-output tr+tr>.navbox-abovebelow,.mw-parser-output tr+tr>.navbox-group,.mw-parser-output tr+tr>.navbox-image,.mw-parser-output tr+tr>.navbox-list{border-top:2px solid #fdfdfd}.mw-parser-output .navbox-title{background-color:#ccf}.mw-parser-output .navbox-abovebelow,.mw-parser-output .navbox-group,.mw-parser-output .navbox-subgroup .navbox-title{background-color:#ddf}.mw-parser-output .navbox-subgroup .navbox-group,.mw-parser-output .navbox-subgroup .navbox-abovebelow{background-color:#e6e6ff}.mw-parser-output .navbox-even{background-color:#f7f7f7}.mw-parser-output .navbox-odd{background-color:transparent}.mw-parser-output .navbox .hlist td dl,.mw-parser-output .navbox .hlist td ol,.mw-parser-output .navbox .hlist td ul,.mw-parser-output .navbox td.hlist dl,.mw-parser-output .navbox td.hlist ol,.mw-parser-output .navbox td.hlist ul{padding:0.125em 0}.mw-parser-output .navbox .navbar{display:block;font-size:100%}.mw-parser-output .navbox-title .navbar{float:left;text-align:left;margin-right:0.5em}body.skin--responsive .mw-parser-output .navbox-image img{max-width:none!important}@media print{body.ns-0 .mw-parser-output .navbox{display:none!important}}</style></div><div role="navigation" class="navbox" aria-labelledby="Data_types177" style="padding:3px"><table class="nowraplinks hlist mw-collapsible autocollapse navbox-inner" style="border-spacing:0;background:transparent;color:inherit"><tbody><tr><th scope="col" class="navbox-title" colspan="2"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1129693374" /><style data-mw-deduplicate="TemplateStyles:r1239400231">.mw-parser-output .navbar{display:inline;font-size:88%;font-weight:normal}.mw-parser-output .navbar-collapse{float:left;text-align:left}.mw-parser-output .navbar-boxtext{word-spacing:0}.mw-parser-output .navbar ul{display:inline-block;white-space:nowrap;line-height:inherit}.mw-parser-output .navbar-brackets::before{margin-right:-0.125em;content:"[ "}.mw-parser-output .navbar-brackets::after{margin-left:-0.125em;content:" ]"}.mw-parser-output .navbar li{word-spacing:-0.125em}.mw-parser-output .navbar a>span,.mw-parser-output .navbar a>abbr{text-decoration:inherit}.mw-parser-output .navbar-mini abbr{font-variant:small-caps;border-bottom:none;text-decoration:none;cursor:inherit}.mw-parser-output .navbar-ct-full{font-size:114%;margin:0 7em}.mw-parser-output .navbar-ct-mini{font-size:114%;margin:0 4em}html.skin-theme-clientpref-night .mw-parser-output .navbar li a abbr{color:var(--color-base)!important}@media(prefers-color-scheme:dark){html.skin-theme-clientpref-os .mw-parser-output .navbar li a abbr{color:var(--color-base)!important}}@media print{.mw-parser-output .navbar{display:none!important}}</style><div class="navbar plainlinks hlist navbar-mini"><ul><li class="nv-view"><a href="/wiki/Template:Data_types" title="Template:Data types"><abbr title="View this template">v</abbr></a></li><li class="nv-talk"><a href="/wiki/Template_talk:Data_types" title="Template talk:Data types"><abbr title="Discuss this template">t</abbr></a></li><li class="nv-edit"><a href="/wiki/Special:EditPage/Template:Data_types" title="Special:EditPage/Template:Data types"><abbr title="Edit this template">e</abbr></a></li></ul></div><div id="Data_types177" style="font-size:114%;margin:0 4em"><a href="/wiki/Data_type" title="Data type">Data types</a></div></th></tr><tr><th scope="row" class="navbox-group" style="width:1%"><a href="/wiki/Units_of_information" title="Units of information">Uninterpreted</a></th><td class="navbox-list-with-group navbox-list navbox-odd" style="width:100%;padding:0"><div style="padding:0 0.25em"> <ul><li><a href="/wiki/Bit" title="Bit">Bit</a></li> <li><a href="/wiki/Byte" title="Byte">Byte</a></li> <li><a href="/wiki/Ternary_numeral_system" title="Ternary numeral system">Trit</a></li> <li><a href="/wiki/Ternary_numeral_system#Tryte" title="Ternary numeral system">Tryte</a></li> <li><a href="/wiki/Word_(computer_architecture)" title="Word (computer architecture)">Word</a></li> <li><a href="/wiki/Bit_array" title="Bit array">Bit array</a></li></ul> </div></td></tr><tr><th scope="row" class="navbox-group" style="width:1%">Numeric</th><td class="navbox-list-with-group navbox-list navbox-even" style="width:100%;padding:0"><div style="padding:0 0.25em"> <ul><li><a href="/wiki/Arbitrary-precision_arithmetic" title="Arbitrary-precision arithmetic">Arbitrary-precision or bignum</a></li> <li><a href="/wiki/Complex_data_type" title="Complex data type">Complex</a></li> <li><a href="/wiki/Decimal_data_type" title="Decimal data type">Decimal</a></li> <li><a href="/wiki/Fixed-point_arithmetic" title="Fixed-point arithmetic">Fixed point</a></li> <li><a href="/wiki/Floating-point_arithmetic" title="Floating-point arithmetic">Floating point</a> <ul><li>Reduced precision <ul><li><a href="/wiki/Minifloat" title="Minifloat">Minifloat</a></li> <li><a href="/wiki/Half-precision_floating-point_format" title="Half-precision floating-point format">Half precision</a></li> <li><a href="/wiki/Bfloat16_floating-point_format" title="Bfloat16 floating-point format">bfloat16</a></li></ul></li> <li><a href="/wiki/Single-precision_floating-point_format" title="Single-precision floating-point format">Single precision</a></li> <li><a href="/wiki/Double-precision_floating-point_format" title="Double-precision floating-point format">Double precision</a></li> <li><a href="/wiki/Quadruple-precision_floating-point_format" title="Quadruple-precision floating-point format">Quadruple precision</a></li> <li><a href="/wiki/Octuple-precision_floating-point_format" title="Octuple-precision floating-point format">Octuple precision</a></li> <li><a href="/wiki/Extended_precision" title="Extended precision">Extended precision</a> <ul><li><a href="/wiki/Long_double" title="Long double">Long double</a></li></ul></li></ul></li> <li><a href="/wiki/Integer_(computer_science)" title="Integer (computer science)">Integer</a> <ul><li><a href="/wiki/Signedness" title="Signedness">signedness</a></li></ul></li> <li><a href="/wiki/Interval_arithmetic#Implementations" title="Interval arithmetic">Interval</a></li> <li><a href="/wiki/Rational_data_type" title="Rational data type">Rational</a></li></ul> </div></td></tr><tr><th scope="row" class="navbox-group" style="width:1%"><a class="mw-selflink selflink">Pointer</a></th><td class="navbox-list-with-group navbox-list navbox-odd" style="width:100%;padding:0"><div style="padding:0 0.25em"> <ul><li><a href="/wiki/Memory_address" title="Memory address">Address</a> <ul><li><a href="/wiki/Physical_address" title="Physical address">physical</a></li> <li><a href="/wiki/Virtual_address_space" title="Virtual address space">virtual</a></li></ul></li> <li><a href="/wiki/Reference_(computer_science)" title="Reference (computer science)">Reference</a></li></ul> </div></td></tr><tr><th scope="row" class="navbox-group" style="width:1%"><a href="/wiki/Plain_text" title="Plain text">Text</a></th><td class="navbox-list-with-group navbox-list navbox-even" style="width:100%;padding:0"><div style="padding:0 0.25em"> <ul><li><a href="/wiki/Character_(computing)" title="Character (computing)">Character</a></li> <li><a href="/wiki/String_(computer_science)" title="String (computer science)">String</a> <ul><li><a href="/wiki/Null-terminated_string" title="Null-terminated string">null-terminated</a></li></ul></li></ul> </div></td></tr><tr><th scope="row" class="navbox-group" style="width:1%"><a href="/wiki/Composite_data_type" title="Composite data type">Composite</a></th><td class="navbox-list-with-group navbox-list navbox-odd" style="width:100%;padding:0"><div style="padding:0 0.25em"> <ul><li><a href="/wiki/Algebraic_data_type" title="Algebraic data type">Algebraic data type</a> <ul><li><a href="/wiki/Generalized_algebraic_data_type" title="Generalized algebraic data type">generalized</a></li></ul></li> <li><a href="/wiki/Array_data_type" class="mw-redirect" title="Array data type">Array</a></li> <li><a href="/wiki/Associative_array" title="Associative array">Associative array</a></li> <li><a href="/wiki/Class_(computer_programming)" title="Class (computer programming)">Class</a></li> <li><a href="/wiki/Dependent_type" title="Dependent type">Dependent</a></li> <li><a href="/wiki/Intuitionistic_type_theory#Equality_type" title="Intuitionistic type theory">Equality</a></li> <li><a href="/wiki/Inductive_type" title="Inductive type">Inductive</a></li> <li><a href="/wiki/Intersection_type" title="Intersection type">Intersection</a></li> <li><a href="/wiki/List_(abstract_data_type)" title="List (abstract data type)">List</a></li> <li><a href="/wiki/Object_(computer_science)" title="Object (computer science)">Object</a> <ul><li><a href="/wiki/Metaobject" title="Metaobject">metaobject</a></li></ul></li> <li><a href="/wiki/Option_type" title="Option type">Option type</a></li> <li><a href="/wiki/Product_type" title="Product type">Product</a></li> <li><a href="/wiki/Record_(computer_science)" title="Record (computer science)">Record or Struct</a></li> <li><a href="/wiki/Refinement_type" title="Refinement type">Refinement</a></li> <li><a href="/wiki/Set_(abstract_data_type)" title="Set (abstract data type)">Set</a></li> <li><a href="/wiki/Union_type" title="Union type">Union</a> <ul><li><a href="/wiki/Tagged_union" title="Tagged union">tagged</a></li></ul></li></ul> </div></td></tr><tr><th scope="row" class="navbox-group" style="width:1%">Other</th><td class="navbox-list-with-group navbox-list navbox-even" style="width:100%;padding:0"><div style="padding:0 0.25em"> <ul><li><a href="/wiki/Boolean_data_type" title="Boolean data type">Boolean</a></li> <li><a href="/wiki/Bottom_type" title="Bottom type">Bottom type</a></li> <li><a href="/wiki/Container_(abstract_data_type)" title="Container (abstract data type)">Collection</a></li> <li><a href="/wiki/Enumerated_type" title="Enumerated type">Enumerated type</a></li> <li><a href="/wiki/Exception_handling" title="Exception handling">Exception</a></li> <li><a href="/wiki/Function_type" title="Function type">Function type</a></li> <li><a href="/wiki/Opaque_data_type" title="Opaque data type">Opaque data type</a></li> <li><a href="/wiki/Recursive_data_type" title="Recursive data type">Recursive data type</a></li> <li><a href="/wiki/Semaphore_(programming)" title="Semaphore (programming)">Semaphore</a></li> <li><a href="/wiki/Stream_(computing)" title="Stream (computing)">Stream</a></li> <li><a href="/wiki/Strongly_typed_identifier" title="Strongly typed identifier">Strongly typed identifier</a></li> <li><a href="/wiki/Top_type" title="Top type">Top type</a></li> <li><a href="/wiki/Type_class" title="Type class">Type class</a></li> <li><a href="/wiki/Empty_type" title="Empty type">Empty type</a></li> <li><a href="/wiki/Unit_type" title="Unit type">Unit type</a></li> <li><a href="/wiki/Void_type" title="Void type">Void</a></li></ul> </div></td></tr><tr><th scope="row" class="navbox-group" style="width:1%">Related<br />topics</th><td class="navbox-list-with-group navbox-list navbox-odd" style="width:100%;padding:0"><div style="padding:0 0.25em"> <ul><li><a href="/wiki/Abstract_data_type" title="Abstract data type">Abstract data type</a></li> <li><a href="/wiki/Boxing_(computer_science)" class="mw-redirect" title="Boxing (computer science)">Boxing</a></li> <li><a href="/wiki/Data_structure" title="Data structure">Data structure</a></li> <li><a href="/wiki/Generic_programming" title="Generic programming">Generic</a></li> <li><a href="/wiki/Kind_(type_theory)" title="Kind (type theory)">Kind</a> <ul><li><a href="/wiki/Metaclass" title="Metaclass">metaclass</a></li></ul></li> <li><a href="/wiki/Parametric_polymorphism" title="Parametric polymorphism">Parametric polymorphism</a></li> <li><a href="/wiki/Primitive_data_type" title="Primitive data type">Primitive data type</a></li> <li><a href="/wiki/Interface_(object-oriented_programming)" title="Interface (object-oriented programming)">Interface</a></li> <li><a href="/wiki/Subtyping" title="Subtyping">Subtyping</a></li> <li><a href="/wiki/Type_constructor" title="Type constructor">Type constructor</a></li> <li><a href="/wiki/Type_conversion" title="Type conversion">Type conversion</a></li> <li><a href="/wiki/Type_system" title="Type system">Type system</a></li> <li><a href="/wiki/Type_theory" title="Type theory">Type theory</a></li> <li><a href="/wiki/Variable_(computer_science)" title="Variable (computer science)">Variable</a></li></ul> </div></td></tr></tbody></table></div> <div class="navbox-styles"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1129693374" /><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1236075235" /></div><div role="navigation" class="navbox authority-control" aria-label="Navbox390" style="padding:3px"><table class="nowraplinks hlist navbox-inner" style="border-spacing:0;background:transparent;color:inherit"><tbody><tr><th scope="row" class="navbox-group" style="width:1%"><a href="/wiki/Help:Authority_control" title="Help:Authority control">Authority control databases</a>: National <span class="mw-valign-text-top noprint" typeof="mw:File/Frameless"><a href="https://www.wikidata.org/wiki/Q118155#identifiers" title="Edit this at Wikidata"><img alt="Edit this at Wikidata" src="//upload.wikimedia.org/wikipedia/en/thumb/8/8a/OOjs_UI_icon_edit-ltr-progressive.svg/10px-OOjs_UI_icon_edit-ltr-progressive.svg.png" decoding="async" width="10" height="10" class="mw-file-element" srcset="//upload.wikimedia.org/wikipedia/en/thumb/8/8a/OOjs_UI_icon_edit-ltr-progressive.svg/15px-OOjs_UI_icon_edit-ltr-progressive.svg.png 1.5x, //upload.wikimedia.org/wikipedia/en/thumb/8/8a/OOjs_UI_icon_edit-ltr-progressive.svg/20px-OOjs_UI_icon_edit-ltr-progressive.svg.png 2x" data-file-width="20" data-file-height="20" /></a></span></th><td class="navbox-list-with-group navbox-list navbox-odd" style="width:100%;padding:0"><div style="padding:0 0.25em"><ul><li><span class="uid"><a rel="nofollow" class="external text" href="https://d-nb.info/gnd/4285887-2">Germany</a></span></li></ul></div></td></tr></tbody></table></div> <!-- NewPP limit report Parsed by mw‐api‐ext.codfw.main‐f89f8ff74‐cqhmb Cached time: 20250326141736 Cache expiry: 2592000 Reduced expiry: false Complications: [vary‐revision‐sha1, show‐toc] CPU time usage: 0.712 seconds Real time usage: 2.678 seconds Preprocessor visited node count: 4198/1000000 Post‐expand include size: 76513/2097152 bytes Template argument size: 7454/2097152 bytes Highest expansion depth: 16/100 Expensive parser function count: 42/500 Unstrip recursion depth: 1/20 Unstrip post‐expand size: 129616/5000000 bytes Lua time usage: 0.342/10.000 seconds Lua memory usage: 6994600/52428800 bytes Number of Wikibase entities loaded: 1/400 --> <!-- Transclusion expansion time report (%,ms,calls,template) 100.00% 2473.585 1 -total 8.62% 213.290 2 Template:Reflist 5.37% 132.756 1 Template:Data_types 5.34% 132.031 1 Template:Short_description 3.72% 92.123 1 Template:Navbox 3.63% 89.813 1 Template:Cite_journal 2.66% 65.781 2 Template:Pagetype 2.61% 64.466 1 Template:More_citations_needed 2.44% 60.404 3 Template:Sister_project 2.38% 58.962 1 Template:Ambox --> <!-- Saved in parser cache with key enwiki:pcache:459018:|#|:idhash:canonical and timestamp 20250326141736 and revision id 1281405968. Rendering was triggered because: unknown --> </div><!--esi <esi:include src="/esitest-fa8a495983347898/content" /> --><noscript><img src="https://login.wikimedia.org/wiki/Special:CentralAutoLogin/start?useformat=desktop&amp;type=1x1&amp;usesul3=0" alt="" width="1" height="1" style="border: none; position: absolute;"></noscript> <div class="printfooter" data-nosnippet="">Retrieved from "<a dir="ltr" href="https://en.wikipedia.org/w/index.php?title=Pointer_(computer_programming)&amp;oldid=1281405968">https://en.wikipedia.org/w/index.php?title=Pointer_(computer_programming)&amp;oldid=1281405968</a>"</div></div> <div id="catlinks" class="catlinks" data-mw="interface"><div id="mw-normal-catlinks" class="mw-normal-catlinks"><a href="/wiki/Help:Category" title="Help:Category">Categories</a>: <ul><li><a href="/wiki/Category:Pointers_(computer_programming)" title="Category:Pointers (computer programming)">Pointers (computer programming)</a></li><li><a href="/wiki/Category:Primitive_types" title="Category:Primitive types">Primitive types</a></li><li><a href="/wiki/Category:American_inventions" title="Category:American inventions">American inventions</a></li><li><a href="/wiki/Category:Programming_language_comparisons" title="Category:Programming language comparisons">Programming language comparisons</a></li></ul></div><div id="mw-hidden-catlinks" class="mw-hidden-catlinks mw-hidden-cats-hidden">Hidden categories: <ul><li><a href="/wiki/Category:Webarchive_template_wayback_links" title="Category:Webarchive template wayback links">Webarchive template wayback links</a></li><li><a href="/wiki/Category:Articles_with_short_description" title="Category:Articles with short description">Articles with short description</a></li><li><a href="/wiki/Category:Short_description_is_different_from_Wikidata" title="Category:Short description is different from Wikidata">Short description is different from Wikidata</a></li><li><a href="/wiki/Category:Articles_needing_additional_references_from_April_2018" title="Category:Articles needing additional references from April 2018">Articles needing additional references from April 2018</a></li><li><a href="/wiki/Category:All_articles_needing_additional_references" title="Category:All articles needing additional references">All articles needing additional references</a></li><li><a href="/wiki/Category:All_articles_with_unsourced_statements" title="Category:All articles with unsourced statements">All articles with unsourced statements</a></li><li><a href="/wiki/Category:Articles_with_unsourced_statements_from_May_2009" title="Category:Articles with unsourced statements from May 2009">Articles with unsourced statements from May 2009</a></li><li><a href="/wiki/Category:Articles_with_unsourced_statements_from_July_2011" title="Category:Articles with unsourced statements from July 2011">Articles with unsourced statements from July 2011</a></li><li><a href="/wiki/Category:Articles_with_unsourced_statements_from_September_2011" title="Category:Articles with unsourced statements from September 2011">Articles with unsourced statements from September 2011</a></li><li><a href="/wiki/Category:Articles_with_unsourced_statements_from_February_2014" title="Category:Articles with unsourced statements from February 2014">Articles with unsourced statements from February 2014</a></li><li><a href="/wiki/Category:Commons_category_link_is_on_Wikidata" title="Category:Commons category link is on Wikidata">Commons category link is on Wikidata</a></li><li><a href="/wiki/Category:CS1_maint:_multiple_names:_authors_list" title="Category:CS1 maint: multiple names: authors list">CS1 maint: multiple names: authors list</a></li><li><a href="/wiki/Category:CS1_maint:_numeric_names:_authors_list" title="Category:CS1 maint: numeric names: authors list">CS1 maint: numeric names: authors list</a></li><li><a href="/wiki/Category:Articles_with_example_C_code" title="Category:Articles with example C code">Articles with example C code</a></li><li><a href="/wiki/Category:Articles_with_example_Ada_code" title="Category:Articles with example Ada code">Articles with example Ada code</a></li><li><a href="/wiki/Category:Articles_with_example_BASIC_code" title="Category:Articles with example BASIC code">Articles with example BASIC code</a></li><li><a href="/wiki/Category:Articles_with_example_C%2B%2B_code" title="Category:Articles with example C++ code">Articles with example C++ code</a></li><li><a href="/wiki/Category:Articles_with_example_C_Sharp_code" title="Category:Articles with example C Sharp code">Articles with example C Sharp code</a></li><li><a href="/wiki/Category:Articles_with_example_D_code" title="Category:Articles with example D code">Articles with example D code</a></li><li><a href="/wiki/Category:Articles_with_example_Eiffel_code" title="Category:Articles with example Eiffel code">Articles with example Eiffel code</a></li><li><a href="/wiki/Category:Articles_with_example_Fortran_code" title="Category:Articles with example Fortran code">Articles with example Fortran code</a></li><li><a href="/wiki/Category:Articles_with_example_Java_code" title="Category:Articles with example Java code">Articles with example Java code</a></li><li><a href="/wiki/Category:Articles_with_example_Pascal_code" title="Category:Articles with example Pascal code">Articles with example Pascal code</a></li></ul></div></div> </div> </main> </div> <div class="mw-footer-container"> <footer id="footer" class="mw-footer" > <ul id="footer-info"> <li id="footer-info-lastmod"> This page was last edited on 20 March 2025, at 04:54<span class="anonymous-show">&#160;(UTC)</span>.</li> <li id="footer-info-copyright">Text is available under the <a href="/wiki/Wikipedia:Text_of_the_Creative_Commons_Attribution-ShareAlike_4.0_International_License" title="Wikipedia:Text of the Creative Commons Attribution-ShareAlike 4.0 International License">Creative Commons Attribution-ShareAlike 4.0 License</a>; additional terms may apply. By using this site, you agree to the <a href="https://foundation.wikimedia.org/wiki/Special:MyLanguage/Policy:Terms_of_Use" class="extiw" title="foundation:Special:MyLanguage/Policy:Terms of Use">Terms of Use</a> and <a href="https://foundation.wikimedia.org/wiki/Special:MyLanguage/Policy:Privacy_policy" class="extiw" title="foundation:Special:MyLanguage/Policy:Privacy policy">Privacy Policy</a>. Wikipedia® is a registered trademark of the <a rel="nofollow" class="external text" href="https://wikimediafoundation.org/">Wikimedia Foundation, Inc.</a>, a non-profit organization.</li> </ul> <ul id="footer-places"> <li id="footer-places-privacy"><a href="https://foundation.wikimedia.org/wiki/Special:MyLanguage/Policy:Privacy_policy">Privacy policy</a></li> <li id="footer-places-about"><a href="/wiki/Wikipedia:About">About Wikipedia</a></li> <li id="footer-places-disclaimers"><a href="/wiki/Wikipedia:General_disclaimer">Disclaimers</a></li> <li id="footer-places-contact"><a href="//en.wikipedia.org/wiki/Wikipedia:Contact_us">Contact Wikipedia</a></li> <li id="footer-places-wm-codeofconduct"><a href="https://foundation.wikimedia.org/wiki/Special:MyLanguage/Policy:Universal_Code_of_Conduct">Code of Conduct</a></li> <li id="footer-places-developers"><a href="https://developer.wikimedia.org">Developers</a></li> <li id="footer-places-statslink"><a href="https://stats.wikimedia.org/#/en.wikipedia.org">Statistics</a></li> <li id="footer-places-cookiestatement"><a href="https://foundation.wikimedia.org/wiki/Special:MyLanguage/Policy:Cookie_statement">Cookie statement</a></li> <li id="footer-places-mobileview"><a href="//en.m.wikipedia.org/w/index.php?title=Pointer_(computer_programming)&amp;mobileaction=toggle_view_mobile" class="noprint stopMobileRedirectToggle">Mobile view</a></li> </ul> <ul id="footer-icons" class="noprint"> <li id="footer-copyrightico"><a href="https://www.wikimedia.org/" class="cdx-button cdx-button--fake-button cdx-button--size-large cdx-button--fake-button--enabled"><picture><source media="(min-width: 500px)" srcset="/static/images/footer/wikimedia-button.svg" width="84" height="29"><img src="/static/images/footer/wikimedia.svg" width="25" height="25" alt="Wikimedia Foundation" lang="en" loading="lazy"></picture></a></li> <li id="footer-poweredbyico"><a href="https://www.mediawiki.org/" class="cdx-button cdx-button--fake-button cdx-button--size-large cdx-button--fake-button--enabled"><picture><source media="(min-width: 500px)" srcset="/w/resources/assets/poweredby_mediawiki.svg" width="88" height="31"><img src="/w/resources/assets/mediawiki_compact.svg" alt="Powered by MediaWiki" lang="en" width="25" height="25" loading="lazy"></picture></a></li> </ul> </footer> </div> </div> </div> <div class="vector-header-container vector-sticky-header-container"> <div id="vector-sticky-header" class="vector-sticky-header"> <div class="vector-sticky-header-start"> <div class="vector-sticky-header-icon-start vector-button-flush-left vector-button-flush-right" aria-hidden="true"> <button class="cdx-button cdx-button--weight-quiet cdx-button--icon-only vector-sticky-header-search-toggle" tabindex="-1" data-event-name="ui.vector-sticky-search-form.icon"><span class="vector-icon mw-ui-icon-search mw-ui-icon-wikimedia-search"></span> <span>Search</span> </button> </div> <div role="search" class="vector-search-box-vue vector-search-box-show-thumbnail vector-search-box"> <div class="vector-typeahead-search-container"> <div class="cdx-typeahead-search cdx-typeahead-search--show-thumbnail"> <form action="/w/index.php" id="vector-sticky-search-form" class="cdx-search-input cdx-search-input--has-end-button"> <div class="cdx-search-input__input-wrapper" data-search-loc="header-moved"> <div class="cdx-text-input cdx-text-input--has-start-icon"> <input class="cdx-text-input__input" type="search" name="search" placeholder="Search Wikipedia"> <span class="cdx-text-input__icon cdx-text-input__start-icon"></span> </div> <input type="hidden" name="title" value="Special:Search"> </div> <button class="cdx-button cdx-search-input__end-button">Search</button> </form> </div> </div> </div> <div class="vector-sticky-header-context-bar"> <nav aria-label="Contents" class="vector-toc-landmark"> <div id="vector-sticky-header-toc" class="vector-dropdown mw-portlet mw-portlet-sticky-header-toc vector-sticky-header-toc vector-button-flush-left" > <input type="checkbox" id="vector-sticky-header-toc-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-vector-sticky-header-toc" class="vector-dropdown-checkbox " aria-label="Toggle the table of contents" > <label id="vector-sticky-header-toc-label" for="vector-sticky-header-toc-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only " aria-hidden="true" ><span class="vector-icon mw-ui-icon-listBullet mw-ui-icon-wikimedia-listBullet"></span> <span class="vector-dropdown-label-text">Toggle the table of contents</span> </label> <div class="vector-dropdown-content"> <div id="vector-sticky-header-toc-unpinned-container" class="vector-unpinned-container"> </div> </div> </div> </nav> <div class="vector-sticky-header-context-bar-primary" aria-hidden="true" ><span class="mw-page-title-main">Pointer (computer programming)</span></div> </div> </div> <div class="vector-sticky-header-end" aria-hidden="true"> <div class="vector-sticky-header-icons"> <a href="#" class="cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only" id="ca-talk-sticky-header" tabindex="-1" data-event-name="talk-sticky-header"><span class="vector-icon mw-ui-icon-speechBubbles mw-ui-icon-wikimedia-speechBubbles"></span> <span></span> </a> <a href="#" class="cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only" id="ca-subject-sticky-header" tabindex="-1" data-event-name="subject-sticky-header"><span class="vector-icon mw-ui-icon-article mw-ui-icon-wikimedia-article"></span> <span></span> </a> <a href="#" class="cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only" id="ca-history-sticky-header" tabindex="-1" data-event-name="history-sticky-header"><span class="vector-icon mw-ui-icon-wikimedia-history mw-ui-icon-wikimedia-wikimedia-history"></span> <span></span> </a> <a href="#" class="cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only mw-watchlink" id="ca-watchstar-sticky-header" tabindex="-1" data-event-name="watch-sticky-header"><span class="vector-icon mw-ui-icon-wikimedia-star mw-ui-icon-wikimedia-wikimedia-star"></span> <span></span> </a> <a href="#" class="cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only" id="ca-edit-sticky-header" tabindex="-1" data-event-name="wikitext-edit-sticky-header"><span class="vector-icon mw-ui-icon-wikimedia-wikiText mw-ui-icon-wikimedia-wikimedia-wikiText"></span> <span></span> </a> <a href="#" class="cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only" id="ca-ve-edit-sticky-header" tabindex="-1" data-event-name="ve-edit-sticky-header"><span class="vector-icon mw-ui-icon-wikimedia-edit mw-ui-icon-wikimedia-wikimedia-edit"></span> <span></span> </a> <a href="#" class="cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only" id="ca-viewsource-sticky-header" tabindex="-1" data-event-name="ve-edit-protected-sticky-header"><span class="vector-icon mw-ui-icon-wikimedia-editLock mw-ui-icon-wikimedia-wikimedia-editLock"></span> <span></span> </a> </div> <div class="vector-sticky-header-buttons"> <button class="cdx-button cdx-button--weight-quiet mw-interlanguage-selector" id="p-lang-btn-sticky-header" tabindex="-1" data-event-name="ui.dropdown-p-lang-btn-sticky-header"><span class="vector-icon mw-ui-icon-wikimedia-language mw-ui-icon-wikimedia-wikimedia-language"></span> <span>45 languages</span> </button> <a href="#" class="cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--action-progressive" id="ca-addsection-sticky-header" tabindex="-1" data-event-name="addsection-sticky-header"><span class="vector-icon mw-ui-icon-speechBubbleAdd-progressive mw-ui-icon-wikimedia-speechBubbleAdd-progressive"></span> <span>Add topic</span> </a> </div> <div class="vector-sticky-header-icon-end"> <div class="vector-user-links"> </div> </div> </div> </div> </div> <div class="mw-portlet mw-portlet-dock-bottom emptyPortlet" id="p-dock-bottom"> <ul> </ul> </div> <script>(RLQ=window.RLQ||[]).push(function(){mw.config.set({"wgHostname":"mw-web.codfw.main-866f5d587f-p9dcz","wgBackendResponseTime":185,"wgPageParseReport":{"limitreport":{"cputime":"0.712","walltime":"2.678","ppvisitednodes":{"value":4198,"limit":1000000},"postexpandincludesize":{"value":76513,"limit":2097152},"templateargumentsize":{"value":7454,"limit":2097152},"expansiondepth":{"value":16,"limit":100},"expensivefunctioncount":{"value":42,"limit":500},"unstrip-depth":{"value":1,"limit":20},"unstrip-size":{"value":129616,"limit":5000000},"entityaccesscount":{"value":1,"limit":400},"timingprofile":["100.00% 2473.585 1 -total"," 8.62% 213.290 2 Template:Reflist"," 5.37% 132.756 1 Template:Data_types"," 5.34% 132.031 1 Template:Short_description"," 3.72% 92.123 1 Template:Navbox"," 3.63% 89.813 1 Template:Cite_journal"," 2.66% 65.781 2 Template:Pagetype"," 2.61% 64.466 1 Template:More_citations_needed"," 2.44% 60.404 3 Template:Sister_project"," 2.38% 58.962 1 Template:Ambox"]},"scribunto":{"limitreport-timeusage":{"value":"0.342","limit":"10.000"},"limitreport-memusage":{"value":6994600,"limit":52428800}},"cachereport":{"origin":"mw-api-ext.codfw.main-f89f8ff74-cqhmb","timestamp":"20250326141736","ttl":2592000,"transientcontent":false}}});});</script> <script type="application/ld+json">{"@context":"https:\/\/schema.org","@type":"Article","name":"Pointer (computer programming)","url":"https:\/\/en.wikipedia.org\/wiki\/Pointer_(computer_programming)","sameAs":"http:\/\/www.wikidata.org\/entity\/Q118155","mainEntity":"http:\/\/www.wikidata.org\/entity\/Q118155","author":{"@type":"Organization","name":"Contributors to Wikimedia projects"},"publisher":{"@type":"Organization","name":"Wikimedia Foundation, Inc.","logo":{"@type":"ImageObject","url":"https:\/\/www.wikimedia.org\/static\/images\/wmf-hor-googpub.png"}},"datePublished":"2001-09-30T22:32:28Z","dateModified":"2025-03-20T04:54:23Z","image":"https:\/\/upload.wikimedia.org\/wikipedia\/commons\/b\/b4\/Pointers.svg","headline":"type which stores memory addresses in a computer program"}</script> </body> </html>

Pages: 1 2 3 4 5 6 7 8 9 10