{"id":5241,"date":"2020-08-22T21:05:48","date_gmt":"2020-08-22T19:05:48","guid":{"rendered":"https:\/\/deepbluembedded.com\/?p=5241"},"modified":"2023-08-17T23:51:18","modified_gmt":"2023-08-17T20:51:18","slug":"pointers-embedded-c","status":"publish","type":"post","link":"https:\/\/deepbluembedded.com\/pointers-embedded-c\/","title":{"rendered":"Pointers In Embedded C &#8211; Null Void Wild Dangling Pointers"},"content":{"rendered":"<table style=\"border-collapse: collapse; width: 100%;\">\n<tbody>\n<tr>\n<td style=\"width: 100%; text-align: center; background-color: #ffffff;\">\n<h2><strong>What Are Null, Void, Dangling, and Wild <\/strong><\/h2>\n<h2><strong>Pointers in Embedded C?<\/strong><\/h2>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 100%; text-align: center; background-color: #ffffff;\"><span style=\"font-size: 14pt;\"><a href=\"https:\/\/deepbluembedded.com\/embedded-systems-interview-questions\/\"><strong>\u2302 Back To Embedded Systems Interview Q&amp;A Page<\/strong><\/a><\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-5245\" src=\"https:\/\/deepbluembedded.com\/wp-content\/uploads\/2020\/08\/Pointers-in-Embedded-C-Wild-Dangling-Void-Null-Pointers.png\" alt=\"Pointers in Embedded C - Wild Dangling Void Null Pointers\" width=\"720\" height=\"340\" srcset=\"https:\/\/deepbluembedded.com\/wp-content\/uploads\/2020\/08\/Pointers-in-Embedded-C-Wild-Dangling-Void-Null-Pointers.png 720w, https:\/\/deepbluembedded.com\/wp-content\/uploads\/2020\/08\/Pointers-in-Embedded-C-Wild-Dangling-Void-Null-Pointers-300x142.png 300w, https:\/\/deepbluembedded.com\/wp-content\/uploads\/2020\/08\/Pointers-in-Embedded-C-Wild-Dangling-Void-Null-Pointers-520x245.png 520w\" sizes=\"auto, (max-width: 720px) 100vw, 720px\" \/><\/p>\n<h3><strong>What&#8217;s A Void Pointer in C?<\/strong><\/h3>\n<p style=\"text-align: justify;\"><span style=\"font-family: arial, helvetica, sans-serif; color: #000000;\"><span style=\"color: #3366ff;\"><strong>A Void Pointer<\/strong><\/span> is a pointer that has no associated data type with it. A void pointer can hold the address of any type and can be type-casted to any type. This means you can use it to point to any variable type you want as shown in the code snippet below.<\/span><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"c\">int x = 10;\r\nchar y = 'B';\r\n\r\nvoid* ptr = &amp;x;\u00a0\/\/ void pointer holds address of int 'x' variable\r\nptr = &amp;y;       \/\/ void pointer holds address of char 'y' variable<\/pre>\n<p style=\"text-align: justify;\"><span style=\"font-family: arial, helvetica, sans-serif; color: #000000;\">Dynamic memory allocation c functions like malloc and calloc return (void *) type and this allows these functions to be used to allocate memory of any data type, as you can type-cast it to fit your variable data type.<\/span><\/p>\n<p style=\"text-align: justify;\"><span style=\"font-family: arial, helvetica, sans-serif; color: #000000;\">Void pointers in C are used to implement generic functions. And note that void pointers cannot be dereferenced. And C standards don\u2019t allow pointer arithmetic with void pointers.<\/span><\/p>\n<hr \/>\n<h3><strong>What&#8217;s A Null Pointer in C?<\/strong><\/h3>\n<p style=\"text-align: justify;\"><span style=\"font-family: arial, helvetica, sans-serif; color: #000000;\"><span style=\"color: #3366ff;\"><strong>A Null Pointer<\/strong><\/span> is a pointer that&#8217;s declared and initialized to be Null which means it doesn&#8217;t point to any meaningful memory location. So you must not dereference a null pointer at any time in code. Actually, we usually check if a pointer is null or not to perform some kind of error detection and handling. If a pointer is correctly assigned, it shouldn&#8217;t contain null, that&#8217;s all.<\/span><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"c\">int* ptr = NULL;<\/pre>\n<p style=\"text-align: justify;\"><span style=\"font-family: arial, helvetica, sans-serif; color: #000000;\">ptr is a Null Pointer that points to nothing and you can&#8217;t dereference it like this ( x = *ptr; ). However, if assigned to any address, the pointer will no longer by null and becomes usable pointer. As shown below.<\/span><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"c\">int* ptr = NULL;\r\nint x = 10;\r\nptr = &amp;x;\r\nprintf(\"%d\", *ptr); \/\/ This prints 10<\/pre>\n<p><span style=\"font-family: arial, helvetica, sans-serif; color: #000000;\">\u00a0Note that: A null pointer is a value, while void pointer is a type.<\/span><\/p>\n<hr \/>\n<h3><strong>What&#8217;s A Dangling Pointer in Embedded C?<\/strong><\/h3>\n<p style=\"text-align: justify;\"><span style=\"font-family: arial, helvetica, sans-serif; color: #000000;\"><span style=\"color: #3366ff;\"><strong>A Dangling Pointer<\/strong><\/span> is a pointer that points to a memory location that has been already free-ed by the application and no longer in use. Therefore, any attempt to dereference a dangling pointer will potentially lead to a runtime error.<\/span><\/p>\n<p style=\"text-align: justify;\"><span style=\"font-family: arial, helvetica, sans-serif; color: #000000;\">Some of the situations that lead to having dangling pointers in the system are the following. A memory location free after being in use for a while will definitely result in a dangling pointer that must not be dereferenced anytime afterward. Also making a pointer that points to a non-static local variable inside a function. Which will be a dangling pointer at the end of the function when the local variables get deleted from the stack. Pointers to static local variables in functions, on the other hand, won&#8217;t lead to having dangling pointers.<\/span><\/p>\n<p><script src=\"\/\/pagead2.googlesyndication.com\/pagead\/js\/adsbygoogle.js\" async=\"\"><\/script><br \/>\n<ins class=\"adsbygoogle\" style=\"display: block; text-align: center;\" data-ad-layout=\"in-article\" data-ad-format=\"fluid\" data-ad-client=\"ca-pub-2505976144802957\" data-ad-slot=\"7632380887\"><\/ins><br \/>\n<script>\n     (adsbygoogle = window.adsbygoogle || []).push({});\n<\/script><\/p>\n<hr \/>\n<h3><strong>What&#8217;s A Wild Pointer in Embedded C?<\/strong><\/h3>\n<p style=\"text-align: justify;\"><span style=\"font-family: arial, helvetica, sans-serif; color: #000000;\"><span style=\"color: #3366ff;\"><strong>A Wild Pointer<\/strong><\/span> is a pointer that has not been initialized to anything (not even NULL). The pointer may be initialized to a non-NULL garbage value that may not be a valid address. Therefore, dereferencing a wild pointer will potentially lead to runtime errors or logical errors that mess up the whole application.<\/span><\/p>\n<p>&nbsp;<\/p>\n<table style=\"border-collapse: collapse; width: 100%;\">\n<tbody>\n<tr>\n<td style=\"width: 100%; background-color: #ffffff; text-align: center;\"><span style=\"font-size: 14pt;\"><a href=\"https:\/\/deepbluembedded.com\/embedded-systems-interview-questions\/\"><strong>\u2302 Back To Embedded Systems Interview Q&amp;A Page<\/strong><\/a><\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><script src=\"\/\/pagead2.googlesyndication.com\/pagead\/js\/adsbygoogle.js\" async=\"\"><\/script><br \/>\n<ins class=\"adsbygoogle\" style=\"display: block; text-align: center;\" data-ad-layout=\"in-article\" data-ad-format=\"fluid\" data-ad-client=\"ca-pub-2505976144802957\" data-ad-slot=\"7632380887\"><\/ins><br \/>\n<script>\n     (adsbygoogle = window.adsbygoogle || []).push({});\n<\/script><\/p>\n","protected":false},"excerpt":{"rendered":"<p> &#8230; <\/p>\n<p class=\"read-more-container\"><a title=\"Pointers In Embedded C &#8211; Null Void Wild Dangling Pointers\" class=\"read-more button\" href=\"https:\/\/deepbluembedded.com\/pointers-embedded-c\/#more-5241\" aria-label=\"Read more about Pointers In Embedded C &#8211; Null Void Wild Dangling Pointers\">Read More<\/a><\/p>\n","protected":false},"author":1,"featured_media":5245,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[71,28,6],"tags":[],"class_list":["post-5241","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-embedded-systems-articles","category-embedded-systems","category-faqs","generate-columns","tablet-grid-50","mobile-grid-100","grid-parent","grid-33","no-featured-image-padding"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Pointers In Embedded C - Null Void Wild Dangling Pointers &#8211; DeepBlue<\/title>\n<meta name=\"description\" content=\"Pointers In Embedded C Types Explained. What&#039;s Null Pointer? What&#039;s Void Pointer? What&#039;s Dangling Pointer? What&#039;s Wild Pointer?\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/deepbluembedded.com\/pointers-embedded-c\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Pointers In Embedded C - Null Void Wild Dangling Pointers &#8211; DeepBlue\" \/>\n<meta property=\"og:description\" content=\"Pointers In Embedded C Types Explained. What&#039;s Null Pointer? What&#039;s Void Pointer? What&#039;s Dangling Pointer? What&#039;s Wild Pointer?\" \/>\n<meta property=\"og:url\" content=\"https:\/\/deepbluembedded.com\/pointers-embedded-c\/\" \/>\n<meta property=\"og:site_name\" content=\"DeepBlue\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/khaled.elrawy.359\/\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/khaled.elrawy.359\/\" \/>\n<meta property=\"article:published_time\" content=\"2020-08-22T19:05:48+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-08-17T20:51:18+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/deepbluembedded.com\/wp-content\/uploads\/2020\/08\/Pointers-in-Embedded-C-Wild-Dangling-Void-Null-Pointers.png\" \/>\n\t<meta property=\"og:image:width\" content=\"720\" \/>\n\t<meta property=\"og:image:height\" content=\"340\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Khaled Magdy\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Khaled Magdy\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/deepbluembedded.com\\\/pointers-embedded-c\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/deepbluembedded.com\\\/pointers-embedded-c\\\/\"},\"author\":{\"name\":\"Khaled Magdy\",\"@id\":\"https:\\\/\\\/deepbluembedded.com\\\/#\\\/schema\\\/person\\\/30259d66cf68c6c681562dbe551b7867\"},\"headline\":\"Pointers In Embedded C &#8211; Null Void Wild Dangling Pointers\",\"datePublished\":\"2020-08-22T19:05:48+00:00\",\"dateModified\":\"2023-08-17T20:51:18+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/deepbluembedded.com\\\/pointers-embedded-c\\\/\"},\"wordCount\":501,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/deepbluembedded.com\\\/#\\\/schema\\\/person\\\/30259d66cf68c6c681562dbe551b7867\"},\"image\":{\"@id\":\"https:\\\/\\\/deepbluembedded.com\\\/pointers-embedded-c\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/deepbluembedded.com\\\/wp-content\\\/uploads\\\/2020\\\/08\\\/Pointers-in-Embedded-C-Wild-Dangling-Void-Null-Pointers.png\",\"articleSection\":[\"Articles\",\"Embedded Systems\",\"FAQs\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/deepbluembedded.com\\\/pointers-embedded-c\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/deepbluembedded.com\\\/pointers-embedded-c\\\/\",\"url\":\"https:\\\/\\\/deepbluembedded.com\\\/pointers-embedded-c\\\/\",\"name\":\"Pointers In Embedded C - Null Void Wild Dangling Pointers &#8211; DeepBlue\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/deepbluembedded.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/deepbluembedded.com\\\/pointers-embedded-c\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/deepbluembedded.com\\\/pointers-embedded-c\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/deepbluembedded.com\\\/wp-content\\\/uploads\\\/2020\\\/08\\\/Pointers-in-Embedded-C-Wild-Dangling-Void-Null-Pointers.png\",\"datePublished\":\"2020-08-22T19:05:48+00:00\",\"dateModified\":\"2023-08-17T20:51:18+00:00\",\"description\":\"Pointers In Embedded C Types Explained. What's Null Pointer? What's Void Pointer? What's Dangling Pointer? What's Wild Pointer?\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/deepbluembedded.com\\\/pointers-embedded-c\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/deepbluembedded.com\\\/pointers-embedded-c\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/deepbluembedded.com\\\/pointers-embedded-c\\\/#primaryimage\",\"url\":\"https:\\\/\\\/deepbluembedded.com\\\/wp-content\\\/uploads\\\/2020\\\/08\\\/Pointers-in-Embedded-C-Wild-Dangling-Void-Null-Pointers.png\",\"contentUrl\":\"https:\\\/\\\/deepbluembedded.com\\\/wp-content\\\/uploads\\\/2020\\\/08\\\/Pointers-in-Embedded-C-Wild-Dangling-Void-Null-Pointers.png\",\"width\":720,\"height\":340,\"caption\":\"Pointers in Embedded C - Wild Dangling Void Null Pointers\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/deepbluembedded.com\\\/pointers-embedded-c\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/deepbluembedded.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Pointers In Embedded C &#8211; Null Void Wild Dangling Pointers\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/deepbluembedded.com\\\/#website\",\"url\":\"https:\\\/\\\/deepbluembedded.com\\\/\",\"name\":\"DeepBlueMbedded\",\"description\":\"Embedded Systems And Computer Engineering Tutorials &amp; Articles\",\"publisher\":{\"@id\":\"https:\\\/\\\/deepbluembedded.com\\\/#\\\/schema\\\/person\\\/30259d66cf68c6c681562dbe551b7867\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/deepbluembedded.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/deepbluembedded.com\\\/#\\\/schema\\\/person\\\/30259d66cf68c6c681562dbe551b7867\",\"name\":\"Khaled Magdy\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/a8b5dc7385ec807e129b584974394d27e41c9979f3a2d0fd785b552b73529032?s=96&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/a8b5dc7385ec807e129b584974394d27e41c9979f3a2d0fd785b552b73529032?s=96&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/a8b5dc7385ec807e129b584974394d27e41c9979f3a2d0fd785b552b73529032?s=96&r=g\",\"caption\":\"Khaled Magdy\"},\"logo\":{\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/a8b5dc7385ec807e129b584974394d27e41c9979f3a2d0fd785b552b73529032?s=96&r=g\"},\"description\":\"Principal Embedded Systems Engineer with years of experience in embedded software and hardware design. I work in the Automotive &amp; e-Mobility industry. However, I still do Hardware design and SW development for DSP, Control Systems, Robotics, AI\\\/ML, and other fields I'm passionate about. I love reading, writing, creating projects, and teaching. A reader by day and a writer by night, it's my lifestyle. I believe that the combination of brilliant minds, bold ideas, and a complete disregard for what is possible, can and will change the world! I will be there when it happens, will you?\",\"sameAs\":[\"https:\\\/\\\/deepbluembedded.com\",\"https:\\\/\\\/www.facebook.com\\\/khaled.elrawy.359\\\/\",\"https:\\\/\\\/www.instagram.com\\\/deepbluembedded\\\/\",\"https:\\\/\\\/www.linkedin.com\\\/in\\\/khaled-magdy-\\\/\",\"https:\\\/\\\/www.youtube.com\\\/channel\\\/UCzLSrNZD4rCjSCOVU9hknvA\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Pointers In Embedded C - Null Void Wild Dangling Pointers &#8211; DeepBlue","description":"Pointers In Embedded C Types Explained. What's Null Pointer? What's Void Pointer? What's Dangling Pointer? What's Wild Pointer?","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:\/\/deepbluembedded.com\/pointers-embedded-c\/","og_locale":"en_US","og_type":"article","og_title":"Pointers In Embedded C - Null Void Wild Dangling Pointers &#8211; DeepBlue","og_description":"Pointers In Embedded C Types Explained. What's Null Pointer? What's Void Pointer? What's Dangling Pointer? What's Wild Pointer?","og_url":"https:\/\/deepbluembedded.com\/pointers-embedded-c\/","og_site_name":"DeepBlue","article_publisher":"https:\/\/www.facebook.com\/khaled.elrawy.359\/","article_author":"https:\/\/www.facebook.com\/khaled.elrawy.359\/","article_published_time":"2020-08-22T19:05:48+00:00","article_modified_time":"2023-08-17T20:51:18+00:00","og_image":[{"width":720,"height":340,"url":"https:\/\/deepbluembedded.com\/wp-content\/uploads\/2020\/08\/Pointers-in-Embedded-C-Wild-Dangling-Void-Null-Pointers.png","type":"image\/png"}],"author":"Khaled Magdy","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Khaled Magdy","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/deepbluembedded.com\/pointers-embedded-c\/#article","isPartOf":{"@id":"https:\/\/deepbluembedded.com\/pointers-embedded-c\/"},"author":{"name":"Khaled Magdy","@id":"https:\/\/deepbluembedded.com\/#\/schema\/person\/30259d66cf68c6c681562dbe551b7867"},"headline":"Pointers In Embedded C &#8211; Null Void Wild Dangling Pointers","datePublished":"2020-08-22T19:05:48+00:00","dateModified":"2023-08-17T20:51:18+00:00","mainEntityOfPage":{"@id":"https:\/\/deepbluembedded.com\/pointers-embedded-c\/"},"wordCount":501,"commentCount":0,"publisher":{"@id":"https:\/\/deepbluembedded.com\/#\/schema\/person\/30259d66cf68c6c681562dbe551b7867"},"image":{"@id":"https:\/\/deepbluembedded.com\/pointers-embedded-c\/#primaryimage"},"thumbnailUrl":"https:\/\/deepbluembedded.com\/wp-content\/uploads\/2020\/08\/Pointers-in-Embedded-C-Wild-Dangling-Void-Null-Pointers.png","articleSection":["Articles","Embedded Systems","FAQs"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/deepbluembedded.com\/pointers-embedded-c\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/deepbluembedded.com\/pointers-embedded-c\/","url":"https:\/\/deepbluembedded.com\/pointers-embedded-c\/","name":"Pointers In Embedded C - Null Void Wild Dangling Pointers &#8211; DeepBlue","isPartOf":{"@id":"https:\/\/deepbluembedded.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/deepbluembedded.com\/pointers-embedded-c\/#primaryimage"},"image":{"@id":"https:\/\/deepbluembedded.com\/pointers-embedded-c\/#primaryimage"},"thumbnailUrl":"https:\/\/deepbluembedded.com\/wp-content\/uploads\/2020\/08\/Pointers-in-Embedded-C-Wild-Dangling-Void-Null-Pointers.png","datePublished":"2020-08-22T19:05:48+00:00","dateModified":"2023-08-17T20:51:18+00:00","description":"Pointers In Embedded C Types Explained. What's Null Pointer? What's Void Pointer? What's Dangling Pointer? What's Wild Pointer?","breadcrumb":{"@id":"https:\/\/deepbluembedded.com\/pointers-embedded-c\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/deepbluembedded.com\/pointers-embedded-c\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/deepbluembedded.com\/pointers-embedded-c\/#primaryimage","url":"https:\/\/deepbluembedded.com\/wp-content\/uploads\/2020\/08\/Pointers-in-Embedded-C-Wild-Dangling-Void-Null-Pointers.png","contentUrl":"https:\/\/deepbluembedded.com\/wp-content\/uploads\/2020\/08\/Pointers-in-Embedded-C-Wild-Dangling-Void-Null-Pointers.png","width":720,"height":340,"caption":"Pointers in Embedded C - Wild Dangling Void Null Pointers"},{"@type":"BreadcrumbList","@id":"https:\/\/deepbluembedded.com\/pointers-embedded-c\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/deepbluembedded.com\/"},{"@type":"ListItem","position":2,"name":"Pointers In Embedded C &#8211; Null Void Wild Dangling Pointers"}]},{"@type":"WebSite","@id":"https:\/\/deepbluembedded.com\/#website","url":"https:\/\/deepbluembedded.com\/","name":"DeepBlueMbedded","description":"Embedded Systems And Computer Engineering Tutorials &amp; Articles","publisher":{"@id":"https:\/\/deepbluembedded.com\/#\/schema\/person\/30259d66cf68c6c681562dbe551b7867"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/deepbluembedded.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/deepbluembedded.com\/#\/schema\/person\/30259d66cf68c6c681562dbe551b7867","name":"Khaled Magdy","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/a8b5dc7385ec807e129b584974394d27e41c9979f3a2d0fd785b552b73529032?s=96&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/a8b5dc7385ec807e129b584974394d27e41c9979f3a2d0fd785b552b73529032?s=96&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/a8b5dc7385ec807e129b584974394d27e41c9979f3a2d0fd785b552b73529032?s=96&r=g","caption":"Khaled Magdy"},"logo":{"@id":"https:\/\/secure.gravatar.com\/avatar\/a8b5dc7385ec807e129b584974394d27e41c9979f3a2d0fd785b552b73529032?s=96&r=g"},"description":"Principal Embedded Systems Engineer with years of experience in embedded software and hardware design. I work in the Automotive &amp; e-Mobility industry. However, I still do Hardware design and SW development for DSP, Control Systems, Robotics, AI\/ML, and other fields I'm passionate about. I love reading, writing, creating projects, and teaching. A reader by day and a writer by night, it's my lifestyle. I believe that the combination of brilliant minds, bold ideas, and a complete disregard for what is possible, can and will change the world! I will be there when it happens, will you?","sameAs":["https:\/\/deepbluembedded.com","https:\/\/www.facebook.com\/khaled.elrawy.359\/","https:\/\/www.instagram.com\/deepbluembedded\/","https:\/\/www.linkedin.com\/in\/khaled-magdy-\/","https:\/\/www.youtube.com\/channel\/UCzLSrNZD4rCjSCOVU9hknvA"]}]}},"jetpack_featured_media_url":"https:\/\/deepbluembedded.com\/wp-content\/uploads\/2020\/08\/Pointers-in-Embedded-C-Wild-Dangling-Void-Null-Pointers.png","jetpack_shortlink":"https:\/\/wp.me\/p9SirL-1mx","jetpack-related-posts":[{"id":3113,"url":"https:\/\/deepbluembedded.com\/programming-languages-for-embedded-systems\/","url_meta":{"origin":5241,"position":0},"title":"Best Programming Languages For Embedded Systems","author":"Khaled Magdy","date":"April 13, 2019","format":false,"excerpt":"What's The Best Programming Language For Embedded Systems? Is it C? Why? \u00a0 As you might be thinking, there is no way to answer such a question without knowing what's meant by \"The Best\". That really depends on what is the type of embedded computer platform involved in developing specific\u2026","rel":"","context":"In &quot;Articles&quot;","block_context":{"text":"Articles","link":"https:\/\/deepbluembedded.com\/embedded-systems\/embedded-systems-articles\/"},"img":{"alt_text":"What's the best programming language for embedded systems","src":"https:\/\/i0.wp.com\/deepbluembedded.com\/wp-content\/uploads\/2019\/04\/Whats-the-best-programming-language-for-embedded-systems.jpg?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/deepbluembedded.com\/wp-content\/uploads\/2019\/04\/Whats-the-best-programming-language-for-embedded-systems.jpg?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/deepbluembedded.com\/wp-content\/uploads\/2019\/04\/Whats-the-best-programming-language-for-embedded-systems.jpg?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/deepbluembedded.com\/wp-content\/uploads\/2019\/04\/Whats-the-best-programming-language-for-embedded-systems.jpg?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":5035,"url":"https:\/\/deepbluembedded.com\/map-function-embedded-c\/","url_meta":{"origin":5241,"position":1},"title":"Map Function, Constrain, FIR Filters, And Other Math Functions","author":"Khaled Magdy","date":"July 6, 2020","format":false,"excerpt":"Previous Tutorial Tutorial 33 Next Tutorial Map Function, Constrain, FIR Filters, And Other Math Functions STM32 Course Home Page ???? \u00a0 \u00a0 In this article, we'll discuss some math functions like map function, constrain, digital filtering, and how to implement them in Embedded-C. We'll be using these functions in the\u2026","rel":"","context":"In &quot;Embedded Systems&quot;","block_context":{"text":"Embedded Systems","link":"https:\/\/deepbluembedded.com\/embedded-systems\/"},"img":{"alt_text":"Map Function, Constrain, And Moving Averge Filters and MATH","src":"https:\/\/i0.wp.com\/deepbluembedded.com\/wp-content\/uploads\/2020\/07\/Map-Function-Constrain-And-Moving-Averge-Filters-and-MATH.jpg?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/deepbluembedded.com\/wp-content\/uploads\/2020\/07\/Map-Function-Constrain-And-Moving-Averge-Filters-and-MATH.jpg?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/deepbluembedded.com\/wp-content\/uploads\/2020\/07\/Map-Function-Constrain-And-Moving-Averge-Filters-and-MATH.jpg?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/deepbluembedded.com\/wp-content\/uploads\/2020\/07\/Map-Function-Constrain-And-Moving-Averge-Filters-and-MATH.jpg?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":2085,"url":"https:\/\/deepbluembedded.com\/how-to-write-isr-handlers\/","url_meta":{"origin":5241,"position":2},"title":"How To Write ISR Handlers","author":"Khaled Magdy","date":"July 15, 2018","format":false,"excerpt":"In this tutorial, we'll discuss a few guidelines to follow while writing ISR handlers. Which you can use as a guide for the upcoming tutorials. Let's see how to properly write ISR handlers!","rel":"","context":"In &quot;Embedded Systems&quot;","block_context":{"text":"Embedded Systems","link":"https:\/\/deepbluembedded.com\/embedded-systems\/"},"img":{"alt_text":"How To Write ISR Handlers - Embedded Systems Tutorials With PIC Microcontrollers","src":"https:\/\/i0.wp.com\/deepbluembedded.com\/wp-content\/uploads\/2018\/07\/How-To-Write-ISR-Handlers-Embedded-Systems-Tutorials-With-PIC-Microcontrollers.jpg?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/deepbluembedded.com\/wp-content\/uploads\/2018\/07\/How-To-Write-ISR-Handlers-Embedded-Systems-Tutorials-With-PIC-Microcontrollers.jpg?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/deepbluembedded.com\/wp-content\/uploads\/2018\/07\/How-To-Write-ISR-Handlers-Embedded-Systems-Tutorials-With-PIC-Microcontrollers.jpg?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/deepbluembedded.com\/wp-content\/uploads\/2018\/07\/How-To-Write-ISR-Handlers-Embedded-Systems-Tutorials-With-PIC-Microcontrollers.jpg?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":4006,"url":"https:\/\/deepbluembedded.com\/multiplexing-7-segment-displays-3-digit-7-segment-interfacing-with-pic-microcontrollers\/","url_meta":{"origin":5241,"position":3},"title":"Multiplexing 7-Segment Displays 3 Digit 7-Segment Interfacing With PIC Microcontrollers","author":"Khaled Magdy","date":"November 29, 2019","format":false,"excerpt":"Previous Tutorial Tutorial 33 Next Tutorial Multiplexing 7-Segment Displays | Multi-Digit 7-Segments Interfacing Introductory Level In this tutorial, we'll be discussing how to interface multiple digits 7-Segments display with pic microcontrollers, or any other MCUs, generally speaking. I'll briefly introduce the phenomenon called \"persistence of vision\" and how we can\u2026","rel":"","context":"In &quot;Electronics Projects&quot;","block_context":{"text":"Electronics Projects","link":"https:\/\/deepbluembedded.com\/electronics\/electronics-projects\/"},"img":{"alt_text":"Multi-Digit 7Segments Tutorial Thumbnail","src":"https:\/\/i0.wp.com\/deepbluembedded.com\/wp-content\/uploads\/2019\/11\/Multi-Digit-7Segments-Tutorial-Thumbnail.jpg?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/deepbluembedded.com\/wp-content\/uploads\/2019\/11\/Multi-Digit-7Segments-Tutorial-Thumbnail.jpg?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/deepbluembedded.com\/wp-content\/uploads\/2019\/11\/Multi-Digit-7Segments-Tutorial-Thumbnail.jpg?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/deepbluembedded.com\/wp-content\/uploads\/2019\/11\/Multi-Digit-7Segments-Tutorial-Thumbnail.jpg?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":3413,"url":"https:\/\/deepbluembedded.com\/temperature-sensor-lm35-interfacing-with-pic-microcontrollers\/","url_meta":{"origin":5241,"position":4},"title":"Temperature Sensor LM35 Interfacing With PIC Microcontrollers","author":"Khaled Magdy","date":"July 7, 2019","format":false,"excerpt":"Previous Tutorial Tutorial 23 Next Tutorial LM35 Temperature Sensor Interfacing Introductory Level \u2605\u2606\u2606\u2606\u2606 \u00a0 In this tutorial, we'll discuss how to interface the LM35 temperature sensor with a PIC microcontroller. Using the ADC to get the analog output voltage of the sensor then converting it back to Celsius degrees, and\u2026","rel":"","context":"In &quot;Electronics&quot;","block_context":{"text":"Electronics","link":"https:\/\/deepbluembedded.com\/electronics\/"},"img":{"alt_text":"LM35 Temperature Sensor Interfacing With PIC Tutorial","src":"https:\/\/i0.wp.com\/deepbluembedded.com\/wp-content\/uploads\/2019\/07\/LM35-Temperature-Sensor-Interfacing-With-PIC-Tutorial.jpg?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/deepbluembedded.com\/wp-content\/uploads\/2019\/07\/LM35-Temperature-Sensor-Interfacing-With-PIC-Tutorial.jpg?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/deepbluembedded.com\/wp-content\/uploads\/2019\/07\/LM35-Temperature-Sensor-Interfacing-With-PIC-Tutorial.jpg?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/deepbluembedded.com\/wp-content\/uploads\/2019\/07\/LM35-Temperature-Sensor-Interfacing-With-PIC-Tutorial.jpg?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":3572,"url":"https:\/\/deepbluembedded.com\/ultrasonic-sensor-distance-measurement-with-hc-sr04-lcd\/","url_meta":{"origin":5241,"position":5},"title":"Ultrasonic Sensor Distance Measurement With HC-SR04 &#038; LCD","author":"Khaled Magdy","date":"August 6, 2019","format":false,"excerpt":"Previous Tutorial Tutorial 26 Next Tutorial Ultrasonic Distance Meter With HC-SR04 & LCD Introductory Level \u2605\u2606\u2606\u2606\u2606 \u00a0 In this tutorial, we'll create a distance meter using the ultrasonic sensor HC-SR04 with an Alphanumeric 16x2 LCD module. In a previous tutorial, we've discussed how HC-SR04 Ultrasonic sensor works and how to\u2026","rel":"","context":"In &quot;Articles&quot;","block_context":{"text":"Articles","link":"https:\/\/deepbluembedded.com\/embedded-systems\/embedded-systems-articles\/"},"img":{"alt_text":"Ultrasonic Distance Meter Measurement Tutorial Thumbnail","src":"https:\/\/i0.wp.com\/deepbluembedded.com\/wp-content\/uploads\/2019\/08\/Ultrasonic-Distance-Meter-Measurement-Tutorial-Thumbnail.jpg?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/deepbluembedded.com\/wp-content\/uploads\/2019\/08\/Ultrasonic-Distance-Meter-Measurement-Tutorial-Thumbnail.jpg?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/deepbluembedded.com\/wp-content\/uploads\/2019\/08\/Ultrasonic-Distance-Meter-Measurement-Tutorial-Thumbnail.jpg?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/deepbluembedded.com\/wp-content\/uploads\/2019\/08\/Ultrasonic-Distance-Meter-Measurement-Tutorial-Thumbnail.jpg?resize=700%2C400&ssl=1 2x"},"classes":[]}],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/deepbluembedded.com\/wp-json\/wp\/v2\/posts\/5241","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/deepbluembedded.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/deepbluembedded.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/deepbluembedded.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/deepbluembedded.com\/wp-json\/wp\/v2\/comments?post=5241"}],"version-history":[{"count":5,"href":"https:\/\/deepbluembedded.com\/wp-json\/wp\/v2\/posts\/5241\/revisions"}],"predecessor-version":[{"id":5247,"href":"https:\/\/deepbluembedded.com\/wp-json\/wp\/v2\/posts\/5241\/revisions\/5247"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/deepbluembedded.com\/wp-json\/wp\/v2\/media\/5245"}],"wp:attachment":[{"href":"https:\/\/deepbluembedded.com\/wp-json\/wp\/v2\/media?parent=5241"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/deepbluembedded.com\/wp-json\/wp\/v2\/categories?post=5241"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/deepbluembedded.com\/wp-json\/wp\/v2\/tags?post=5241"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}