<br />
<b>Warning</b>:  Undefined array key "global_protection_id" in <b>/home/wikitechy/public_html/interview-questions/wp-content/plugins/content-protector/inc/class-ps-rest-handler.php</b> on line <b>51</b><br />
{"id":4903,"date":"2022-10-03T06:33:50","date_gmt":"2022-10-03T06:33:50","guid":{"rendered":"https:\/\/www.wikitechy.com\/interview-questions\/?p=4903"},"modified":"2022-10-03T06:33:50","modified_gmt":"2022-10-03T06:33:50","slug":"what-is-pointer-in-c","status":"publish","type":"post","link":"https:\/\/www.wikitechy.com\/interview-questions\/c\/what-is-pointer-in-c\/","title":{"rendered":"What is Pointer in C ?"},"content":{"rendered":"<ul>\n<li style=\"text-align: justify;\">For storing the address of another variable pointers can be used.<\/li>\n<li style=\"text-align: justify;\">Variables of type int,char, array, function or any other pointer can be of type pointer.<\/li>\n<li style=\"text-align: justify;\">Architecture of a pointer determines the size of the pointer.<\/li>\n<li style=\"text-align: justify;\">Size of the pointer depends on the architecture.<\/li>\n<li style=\"text-align: justify;\">In 32 bit the size of the pointer is 2 byte.<\/li>\n<li style=\"text-align: justify;\">Using pointer some of programming tasks in C can be easily done.<\/li>\n<\/ul>\n<h2 id=\"declaring-a-pointer\" style=\"text-align: justify;\"><strong>Declaring a pointer<\/strong><\/h2>\n<p style=\"text-align: justify; background: white;\"><span lang=\"EN-US\" style=\"font-size: 16.0pt; font-family: 'Segoe UI',sans-serif; color: #333333;\">The pointer in c language can be declared using * (asterisk symbol). It is also known as indirection pointer used to dereference a pointer.<\/span><\/p>\n<div class=\"code-embed-wrapper\"> <div class=\"code-embed-infos\"> <\/div> <pre class=\"language-c code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-c code-embed-code\">int *a; \/\/pointer to int  <br\/>char *c;\/\/pointer to char  <\/code><\/pre> <\/div>\n<h3 id=\"pointer-example\" style=\"text-align: justify;\">Pointer Example:<\/h3>\n<p style=\"text-align: justify;\">An example of using pointers to print the address and value is given below.<\/p>\n<p style=\"text-align: justify;\">\n<p style=\"text-align: justify;\"><img fetchpriority=\"high\" decoding=\"async\" class=\"alignnone size-full wp-image-4904 aligncenter\" src=\"https:\/\/www.wikitechy.com\/interview-questions\/wp-content\/uploads\/2022\/10\/what-is-pointer-in-c.jpg\" alt=\"\" width=\"595\" height=\"297\" srcset=\"https:\/\/www.wikitechy.com\/interview-questions\/wp-content\/uploads\/2022\/10\/what-is-pointer-in-c.jpg 595w, https:\/\/www.wikitechy.com\/interview-questions\/wp-content\/uploads\/2022\/10\/what-is-pointer-in-c-300x150.jpg 300w, https:\/\/www.wikitechy.com\/interview-questions\/wp-content\/uploads\/2022\/10\/what-is-pointer-in-c-390x195.jpg 390w\" sizes=\"(max-width: 595px) 100vw, 595px\" \/><\/p>\n<h3 id=\"pointer-to-array\" style=\"text-align: justify;\"><strong>Pointer to array<\/strong><\/h3>\n<div class=\"code-embed-wrapper\"> <div class=\"code-embed-infos\"> <\/div> <pre class=\"language-c code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-c code-embed-code\">int arr[10];\u00a0\u00a0<br\/>int *p[10]=&amp;arr;\u00a0<\/code><\/pre> <\/div>\n<h3 id=\"pointer-to-a-function\" style=\"text-align: justify;\"><strong>Pointer to a function<\/strong><\/h3>\n<div class=\"code-embed-wrapper\"> <div class=\"code-embed-infos\"> <\/div> <pre class=\"language-c code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-c code-embed-code\">void show\u00a0(int);\u00a0\u00a0<br\/>void(*p)(int)\u00a0=\u00a0&amp;display;\u00a0<\/code><\/pre> <\/div>\n<h3 id=\"pointer-to-structure\" style=\"text-align: justify;\"><strong>\u00a0<\/strong><strong>Pointer to Structure<\/strong><\/h3>\n<div class=\"code-embed-wrapper\"> <div class=\"code-embed-infos\"> <\/div> <pre class=\"language-c code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-c code-embed-code\">struct\u00a0st\u00a0{\u00a0\u00a0<br\/><br\/>\u00a0\u00a0\u00a0int\u00a0i;\u00a0\u00a0<br\/><br\/>\u00a0\u00a0\u00a0\u00a0float\u00a0f;\u00a0\u00a0<br\/><br\/>}ref;\u00a0\u00a0<br\/><br\/>struct\u00a0st\u00a0*p\u00a0=\u00a0&amp;ref;\u00a0\u00a0<\/code><\/pre> <\/div>\n<p style=\"text-align: justify;\"><img decoding=\"async\" class=\"alignnone size-full wp-image-4905 aligncenter\" src=\"https:\/\/www.wikitechy.com\/interview-questions\/wp-content\/uploads\/2022\/10\/pointer-to-structure.png\" alt=\"\" width=\"303\" height=\"96\" srcset=\"https:\/\/www.wikitechy.com\/interview-questions\/wp-content\/uploads\/2022\/10\/pointer-to-structure.png 303w, https:\/\/www.wikitechy.com\/interview-questions\/wp-content\/uploads\/2022\/10\/pointer-to-structure-300x96.png 300w\" sizes=\"(max-width: 303px) 100vw, 303px\" \/><\/p>\n<h2 id=\"advantages-of-pointer\" style=\"text-align: justify;\">Advantages of Pointer<\/h2>\n<ul style=\"text-align: justify;\">\n<li>Pointer reduces the code and improves the performance.<\/li>\n<li>It is used to retrieving strings, trees, etc., and used with arrays, structures, and functions.<\/li>\n<li>We can return multiple values from a function using the pointer.<\/li>\n<li>It makes you able to access any memory location in the computer&#8217;s memory.<\/li>\n<\/ul>\n<h2 id=\"usage-of-pointer\" style=\"text-align: justify;\">Usage of pointer<\/h2>\n<p style=\"text-align: justify;\">There are many applications of pointers in c language.<\/p>\n<p style=\"text-align: justify;\"><strong>Dynamic memory allocation<\/strong><\/p>\n<ul style=\"text-align: justify;\">\n<li>In C language, we can dynamically allocate memory using malloc() and calloc() functions where the pointer is used.<\/li>\n<\/ul>\n<p style=\"text-align: justify;\"><strong>Arrays, Functions, and Structures<\/strong><\/p>\n<ul style=\"text-align: justify;\">\n<li>Pointers in c language are widely used in arrays, functions, and structures.<\/li>\n<li>It reduces the code and improves the performance.<\/li>\n<\/ul>\n<p style=\"text-align: justify;\">\n","protected":false},"excerpt":{"rendered":"<p>For storing the address of another variable pointers can be used. Variables of type int,char, array, function or any other pointer can be of type pointer. Architecture of a pointer determines the size of the pointer. Size of the pointer depends on the architecture. In 32 bit the size of the pointer is 2 byte. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"passster_activate_protection":false,"passster_protect_child_pages":"","passster_protection_type":"password","passster_password":"","passster_activate_overwrite_defaults":"","passster_headline":"","passster_instruction":"","passster_placeholder":"","passster_button":"","passster_id":"","passster_activate_misc_settings":"","passster_redirect_url":"","passster_hide":"no","passster_area_shortcode":"","gtb_hide_title":false,"gtb_wrap_title":false,"gtb_class_title":"","gtb_remove_headerfooter":false,"footnotes":""},"categories":[1716],"tags":[18733,18413,18416,18732,1819,18731,18730,18729,18728],"class_list":["post-4903","post","type-post","status-publish","format-standard","hentry","category-c","tag-advantage-of-pointers-in-c","tag-c-pointers","tag-c-pointers-with-examples","tag-pointer-arithmetic-in-c","tag-pointers-in-c","tag-pointers-in-c-and-c","tag-what-are-pointers-in-c","tag-what-is-pointer","tag-what-is-pointer-in-c-programming"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v22.6 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>What is Pointer in C ? - Pointers in C - C Pointers with Examples<\/title>\n<meta name=\"description\" content=\"What is Pointer in C ? - Pointers in C - C Pointers with Examples - For storing the address of another variable pointers can be used.\" \/>\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-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 Pointer in C ? - Pointers in C - C Pointers with Examples\" \/>\n<meta property=\"og:description\" content=\"What is Pointer in C ? - Pointers in C - C Pointers with Examples - For storing the address of another variable pointers can be used.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wikitechy.com\/interview-questions\/c\/what-is-pointer-in-c\/\" \/>\n<meta property=\"og:site_name\" content=\"Wikitechy\" \/>\n<meta property=\"article:published_time\" content=\"2022-10-03T06:33:50+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wikitechy.com\/interview-questions\/wp-content\/uploads\/2022\/10\/what-is-pointer-in-c.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=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wikitechy.com\/interview-questions\/c\/what-is-pointer-in-c\/\",\"url\":\"https:\/\/www.wikitechy.com\/interview-questions\/c\/what-is-pointer-in-c\/\",\"name\":\"What is Pointer in C ? - Pointers in C - C Pointers with Examples\",\"isPartOf\":{\"@id\":\"https:\/\/www.wikitechy.com\/interview-questions\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.wikitechy.com\/interview-questions\/c\/what-is-pointer-in-c\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.wikitechy.com\/interview-questions\/c\/what-is-pointer-in-c\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.wikitechy.com\/interview-questions\/wp-content\/uploads\/2022\/10\/what-is-pointer-in-c.jpg\",\"datePublished\":\"2022-10-03T06:33:50+00:00\",\"dateModified\":\"2022-10-03T06:33:50+00:00\",\"author\":{\"@id\":\"https:\/\/www.wikitechy.com\/interview-questions\/#\/schema\/person\/f785ba3ecc599133e65ab6138042a3e4\"},\"description\":\"What is Pointer in C ? - Pointers in C - C Pointers with Examples - For storing the address of another variable pointers can be used.\",\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wikitechy.com\/interview-questions\/c\/what-is-pointer-in-c\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.wikitechy.com\/interview-questions\/c\/what-is-pointer-in-c\/#primaryimage\",\"url\":\"https:\/\/www.wikitechy.com\/interview-questions\/wp-content\/uploads\/2022\/10\/what-is-pointer-in-c.jpg\",\"contentUrl\":\"https:\/\/www.wikitechy.com\/interview-questions\/wp-content\/uploads\/2022\/10\/what-is-pointer-in-c.jpg\",\"width\":595,\"height\":297},{\"@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\":\"required name=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:\/\/www.wikitechy.com\/interview-questions\/#\/schema\/person\/image\/\",\"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 Pointer in C ? - Pointers in C - C Pointers with Examples","description":"What is Pointer in C ? - Pointers in C - C Pointers with Examples - For storing the address of another variable pointers can be used.","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-pointer-in-c\/","og_locale":"en_US","og_type":"article","og_title":"What is Pointer in C ? - Pointers in C - C Pointers with Examples","og_description":"What is Pointer in C ? - Pointers in C - C Pointers with Examples - For storing the address of another variable pointers can be used.","og_url":"https:\/\/www.wikitechy.com\/interview-questions\/c\/what-is-pointer-in-c\/","og_site_name":"Wikitechy","article_published_time":"2022-10-03T06:33:50+00:00","og_image":[{"url":"https:\/\/www.wikitechy.com\/interview-questions\/wp-content\/uploads\/2022\/10\/what-is-pointer-in-c.jpg"}],"author":"webmaster","twitter_card":"summary_large_image","twitter_misc":{"Written by":"webmaster","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wikitechy.com\/interview-questions\/c\/what-is-pointer-in-c\/","url":"https:\/\/www.wikitechy.com\/interview-questions\/c\/what-is-pointer-in-c\/","name":"What is Pointer in C ? - Pointers in C - C Pointers with Examples","isPartOf":{"@id":"https:\/\/www.wikitechy.com\/interview-questions\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.wikitechy.com\/interview-questions\/c\/what-is-pointer-in-c\/#primaryimage"},"image":{"@id":"https:\/\/www.wikitechy.com\/interview-questions\/c\/what-is-pointer-in-c\/#primaryimage"},"thumbnailUrl":"https:\/\/www.wikitechy.com\/interview-questions\/wp-content\/uploads\/2022\/10\/what-is-pointer-in-c.jpg","datePublished":"2022-10-03T06:33:50+00:00","dateModified":"2022-10-03T06:33:50+00:00","author":{"@id":"https:\/\/www.wikitechy.com\/interview-questions\/#\/schema\/person\/f785ba3ecc599133e65ab6138042a3e4"},"description":"What is Pointer in C ? - Pointers in C - C Pointers with Examples - For storing the address of another variable pointers can be used.","inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wikitechy.com\/interview-questions\/c\/what-is-pointer-in-c\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.wikitechy.com\/interview-questions\/c\/what-is-pointer-in-c\/#primaryimage","url":"https:\/\/www.wikitechy.com\/interview-questions\/wp-content\/uploads\/2022\/10\/what-is-pointer-in-c.jpg","contentUrl":"https:\/\/www.wikitechy.com\/interview-questions\/wp-content\/uploads\/2022\/10\/what-is-pointer-in-c.jpg","width":595,"height":297},{"@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":"required name=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:\/\/www.wikitechy.com\/interview-questions\/#\/schema\/person\/image\/","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\/4903","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=4903"}],"version-history":[{"count":1,"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/posts\/4903\/revisions"}],"predecessor-version":[{"id":4906,"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/posts\/4903\/revisions\/4906"}],"wp:attachment":[{"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/media?parent=4903"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/categories?post=4903"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/tags?post=4903"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}