{"id":4944,"date":"2022-10-06T10:38:33","date_gmt":"2022-10-06T10:38:33","guid":{"rendered":"https:\/\/www.wikitechy.com\/interview-questions\/?p=4944"},"modified":"2022-10-06T10:38:33","modified_gmt":"2022-10-06T10:38:33","slug":"what-is-dangling-pointer-in-c","status":"publish","type":"post","link":"https:\/\/www.wikitechy.com\/interview-questions\/c\/what-is-dangling-pointer-in-c\/","title":{"rendered":"What is dangling Pointer in c ?"},"content":{"rendered":"<ul>\n<li style=\"text-align: justify;\">The most common bugs related to pointer & memory management is called dangling or wild pointers.<\/li>\n<li>Sometimes programmer fails to assign the pointer with a valid address, then this type of assigned or initialized pointer is known as dangling pointer.<\/li>\n<li>Dangling pointer usually occurs during object destruction when the object is deleted or deallocated from memory without changing the values or address of the pointer.<\/li>\n<li>Dangling pointer points to the memory which contains either the program code or code of the operating system.<\/li>\n<li>If a value or address is assigned to this type of pointer, it overwrites the program\u2019s value or operating system instructions.<\/li>\n<li>During this time, the program may show the undesirable results or may crash.<\/li>\n<li>If the memory is re allocated to some other process, then we will dereference the dangling pointer.<\/li>\n<li style=\"text-align: justify;\">This dereferencing of the dangling pointer may cause segmentation faults.<\/li>\n<\/ul>\n<p><img fetchpriority=\"high\" decoding=\"async\" class=\"alignnone size-full wp-image-4945 aligncenter\" src=\"https:\/\/www.wikitechy.com\/interview-questions\/wp-content\/uploads\/2022\/10\/what-do-you-mean-by-dangling-pointer.jpg\" alt=\"\" width=\"388\" height=\"285\" srcset=\"https:\/\/www.wikitechy.com\/interview-questions\/wp-content\/uploads\/2022\/10\/what-do-you-mean-by-dangling-pointer.jpg 388w, https:\/\/www.wikitechy.com\/interview-questions\/wp-content\/uploads\/2022\/10\/what-do-you-mean-by-dangling-pointer-300x220.jpg 300w\" sizes=\"(max-width: 388px) 100vw, 388px\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The most common bugs related to pointer &#038; memory management is called dangling or wild pointers. Sometimes programmer fails to assign the pointer with a valid address, then this type of assigned or initialized pointer is known as dangling pointer. Dangling pointer usually occurs during object destruction when the object is deleted or deallocated from [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1716],"tags":[18830,2543,18829,2546,2560,18826,2544,18828,18824,18825,18827,2529],"class_list":["post-4944","post","type-post","status-publish","format-standard","hentry","category-c","tag-dangline-pointer","tag-dangling-pointer","tag-dangling-pointer-c","tag-dangling-pointer-example","tag-dangling-pointer-in-c-example","tag-dangling-pointer-in-c-with-example","tag-dangling-pointer-in-c","tag-dangling-pointers-and-memory-faults","tag-dangling-pointers-in-c","tag-understanding-the-dangling-pointers","tag-what-is-a-dangling-pointer","tag-what-is-dangling-pointer-and-how-to-avoid-it"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.6 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>What is dangling pointer in C - Dangling Pointer C<\/title>\n<meta name=\"description\" content=\"What do you mean by Dangling Pointer Variable in C Programming ? - The most common bugs related to pointer &amp; memory management is called dangling or wild pointers.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wikitechy.com\/interview-questions\/c\/what-is-dangling-pointer-in-c\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"What is dangling pointer in C - Dangling Pointer C\" \/>\n<meta property=\"og:description\" content=\"What do you mean by Dangling Pointer Variable in C Programming ? - The most common bugs related to pointer &amp; memory management is called dangling or wild pointers.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wikitechy.com\/interview-questions\/c\/what-is-dangling-pointer-in-c\/\" \/>\n<meta property=\"og:site_name\" content=\"Wikitechy\" \/>\n<meta property=\"article:published_time\" content=\"2022-10-06T10:38:33+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wikitechy.com\/interview-questions\/wp-content\/uploads\/2022\/10\/what-do-you-mean-by-dangling-pointer.jpg\" \/>\n<meta name=\"author\" content=\"webmaster\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"webmaster\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/c\\\/what-is-dangling-pointer-in-c\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/c\\\/what-is-dangling-pointer-in-c\\\/\"},\"author\":{\"name\":\"webmaster\",\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/#\\\/schema\\\/person\\\/f785ba3ecc599133e65ab6138042a3e4\"},\"headline\":\"What is dangling Pointer in c ?\",\"datePublished\":\"2022-10-06T10:38:33+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/c\\\/what-is-dangling-pointer-in-c\\\/\"},\"wordCount\":151,\"commentCount\":0,\"image\":{\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/c\\\/what-is-dangling-pointer-in-c\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/wp-content\\\/uploads\\\/2022\\\/10\\\/what-do-you-mean-by-dangling-pointer.jpg\",\"keywords\":[\"dangline pointer\",\"dangling pointer\",\"dangling pointer c\",\"dangling pointer example\",\"dangling pointer in c example\",\"dangling pointer in c with example\",\"dangling pointer in c++\",\"dangling pointers and memory faults\",\"dangling pointers in c\",\"understanding the dangling pointers\",\"what is a dangling pointer\",\"what is dangling pointer and how to avoid it\"],\"articleSection\":[\"C\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/c\\\/what-is-dangling-pointer-in-c\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/c\\\/what-is-dangling-pointer-in-c\\\/\",\"url\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/c\\\/what-is-dangling-pointer-in-c\\\/\",\"name\":\"What is dangling pointer in C - Dangling Pointer C\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/c\\\/what-is-dangling-pointer-in-c\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/c\\\/what-is-dangling-pointer-in-c\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/wp-content\\\/uploads\\\/2022\\\/10\\\/what-do-you-mean-by-dangling-pointer.jpg\",\"datePublished\":\"2022-10-06T10:38:33+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/#\\\/schema\\\/person\\\/f785ba3ecc599133e65ab6138042a3e4\"},\"description\":\"What do you mean by Dangling Pointer Variable in C Programming ? - The most common bugs related to pointer & memory management is called dangling or wild pointers.\",\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/c\\\/what-is-dangling-pointer-in-c\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/c\\\/what-is-dangling-pointer-in-c\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/wp-content\\\/uploads\\\/2022\\\/10\\\/what-do-you-mean-by-dangling-pointer.jpg\",\"contentUrl\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/wp-content\\\/uploads\\\/2022\\\/10\\\/what-do-you-mean-by-dangling-pointer.jpg\",\"width\":388,\"height\":285},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/#website\",\"url\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/\",\"name\":\"Wikitechy\",\"description\":\"Interview Questions\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/#\\\/schema\\\/person\\\/f785ba3ecc599133e65ab6138042a3e4\",\"name\":\"webmaster\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/155b77fd8cdda3d0913fcb7e7ee63543b0c345d2d8f6dcebda5b0583ab61f967?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/155b77fd8cdda3d0913fcb7e7ee63543b0c345d2d8f6dcebda5b0583ab61f967?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/155b77fd8cdda3d0913fcb7e7ee63543b0c345d2d8f6dcebda5b0583ab61f967?s=96&d=mm&r=g\",\"caption\":\"webmaster\"},\"sameAs\":[\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\"],\"url\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/author\\\/webmaster\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"What is dangling pointer in C - Dangling Pointer C","description":"What do you mean by Dangling Pointer Variable in C Programming ? - The most common bugs related to pointer & memory management is called dangling or wild pointers.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wikitechy.com\/interview-questions\/c\/what-is-dangling-pointer-in-c\/","og_locale":"en_US","og_type":"article","og_title":"What is dangling pointer in C - Dangling Pointer C","og_description":"What do you mean by Dangling Pointer Variable in C Programming ? - The most common bugs related to pointer & memory management is called dangling or wild pointers.","og_url":"https:\/\/www.wikitechy.com\/interview-questions\/c\/what-is-dangling-pointer-in-c\/","og_site_name":"Wikitechy","article_published_time":"2022-10-06T10:38:33+00:00","og_image":[{"url":"https:\/\/www.wikitechy.com\/interview-questions\/wp-content\/uploads\/2022\/10\/what-do-you-mean-by-dangling-pointer.jpg","type":"","width":"","height":""}],"author":"webmaster","twitter_card":"summary_large_image","twitter_misc":{"Written by":"webmaster","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.wikitechy.com\/interview-questions\/c\/what-is-dangling-pointer-in-c\/#article","isPartOf":{"@id":"https:\/\/www.wikitechy.com\/interview-questions\/c\/what-is-dangling-pointer-in-c\/"},"author":{"name":"webmaster","@id":"https:\/\/www.wikitechy.com\/interview-questions\/#\/schema\/person\/f785ba3ecc599133e65ab6138042a3e4"},"headline":"What is dangling Pointer in c ?","datePublished":"2022-10-06T10:38:33+00:00","mainEntityOfPage":{"@id":"https:\/\/www.wikitechy.com\/interview-questions\/c\/what-is-dangling-pointer-in-c\/"},"wordCount":151,"commentCount":0,"image":{"@id":"https:\/\/www.wikitechy.com\/interview-questions\/c\/what-is-dangling-pointer-in-c\/#primaryimage"},"thumbnailUrl":"https:\/\/www.wikitechy.com\/interview-questions\/wp-content\/uploads\/2022\/10\/what-do-you-mean-by-dangling-pointer.jpg","keywords":["dangline pointer","dangling pointer","dangling pointer c","dangling pointer example","dangling pointer in c example","dangling pointer in c with example","dangling pointer in c++","dangling pointers and memory faults","dangling pointers in c","understanding the dangling pointers","what is a dangling pointer","what is dangling pointer and how to avoid it"],"articleSection":["C"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.wikitechy.com\/interview-questions\/c\/what-is-dangling-pointer-in-c\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.wikitechy.com\/interview-questions\/c\/what-is-dangling-pointer-in-c\/","url":"https:\/\/www.wikitechy.com\/interview-questions\/c\/what-is-dangling-pointer-in-c\/","name":"What is dangling pointer in C - Dangling Pointer C","isPartOf":{"@id":"https:\/\/www.wikitechy.com\/interview-questions\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.wikitechy.com\/interview-questions\/c\/what-is-dangling-pointer-in-c\/#primaryimage"},"image":{"@id":"https:\/\/www.wikitechy.com\/interview-questions\/c\/what-is-dangling-pointer-in-c\/#primaryimage"},"thumbnailUrl":"https:\/\/www.wikitechy.com\/interview-questions\/wp-content\/uploads\/2022\/10\/what-do-you-mean-by-dangling-pointer.jpg","datePublished":"2022-10-06T10:38:33+00:00","author":{"@id":"https:\/\/www.wikitechy.com\/interview-questions\/#\/schema\/person\/f785ba3ecc599133e65ab6138042a3e4"},"description":"What do you mean by Dangling Pointer Variable in C Programming ? - The most common bugs related to pointer & memory management is called dangling or wild pointers.","inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wikitechy.com\/interview-questions\/c\/what-is-dangling-pointer-in-c\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.wikitechy.com\/interview-questions\/c\/what-is-dangling-pointer-in-c\/#primaryimage","url":"https:\/\/www.wikitechy.com\/interview-questions\/wp-content\/uploads\/2022\/10\/what-do-you-mean-by-dangling-pointer.jpg","contentUrl":"https:\/\/www.wikitechy.com\/interview-questions\/wp-content\/uploads\/2022\/10\/what-do-you-mean-by-dangling-pointer.jpg","width":388,"height":285},{"@type":"WebSite","@id":"https:\/\/www.wikitechy.com\/interview-questions\/#website","url":"https:\/\/www.wikitechy.com\/interview-questions\/","name":"Wikitechy","description":"Interview Questions","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wikitechy.com\/interview-questions\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.wikitechy.com\/interview-questions\/#\/schema\/person\/f785ba3ecc599133e65ab6138042a3e4","name":"webmaster","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/155b77fd8cdda3d0913fcb7e7ee63543b0c345d2d8f6dcebda5b0583ab61f967?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/155b77fd8cdda3d0913fcb7e7ee63543b0c345d2d8f6dcebda5b0583ab61f967?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/155b77fd8cdda3d0913fcb7e7ee63543b0c345d2d8f6dcebda5b0583ab61f967?s=96&d=mm&r=g","caption":"webmaster"},"sameAs":["https:\/\/www.wikitechy.com\/interview-questions"],"url":"https:\/\/www.wikitechy.com\/interview-questions\/author\/webmaster\/"}]}},"_links":{"self":[{"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/posts\/4944","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/comments?post=4944"}],"version-history":[{"count":1,"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/posts\/4944\/revisions"}],"predecessor-version":[{"id":4946,"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/posts\/4944\/revisions\/4946"}],"wp:attachment":[{"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/media?parent=4944"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/categories?post=4944"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/tags?post=4944"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}