{"id":221,"date":"2020-07-18T10:35:52","date_gmt":"2020-07-18T10:35:52","guid":{"rendered":"\/?p=221"},"modified":"2022-04-13T05:33:46","modified_gmt":"2022-04-13T05:33:46","slug":"concept-of-pointerpart-2","status":"publish","type":"post","link":"http:\/\/suryaprakash.com.np\/?p=221","title":{"rendered":"Concept of Pointer(Part-2)"},"content":{"rendered":"<p style=\"text-align: justify;\"><code>\/\/pointer2<\/code><br \/>\n<code>#include&lt;stdio.h&gt;<\/code><br \/>\n<code>void main()<\/code><br \/>\n<code>{<\/code><br \/>\n<code>int *p[10]; <strong>\/\/it is an array of 10 pointers that is there are 10 pointer declared here.<\/strong><\/code><br \/>\n<code>int (*q)[10];\u00a0 <strong>\/\/it is a single pointer which points an array of integer.that is q points\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0the base address of array<\/strong><\/code><br \/>\n<code>int a[10]={0,1,2,3,4,5,6,7,8,9};<\/code><br \/>\n<code>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0<strong>\/\/ p=&amp;a \/\/this line show error because p is an array. That is\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0multiple variable but &amp;a means the base address(a single\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 variable) of array a[10] that is a[0]. <\/strong><\/code><strong>Hence,<\/strong><code><strong>multiple\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 value=single value is invalid.<\/strong> <\/code><br \/>\n<code>p[0]=&amp;a[0];<\/code><br \/>\n<code>p[1]=&amp;a[1];<\/code><br \/>\n<code>p[2]=&amp;a[2];<\/code><br \/>\n<code>q=&amp;a;\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0<strong>\/\/it points the base address of array a. so the q=&amp;a[0]<\/strong><\/code><br \/>\n<code>printf(\"%d\\t%d\\t%d\\t%d\\t%d\\t%d\",p[0],p[1],p[2],q,&amp;a[0],&amp;a);<\/code><br \/>\n<code>}<\/code><\/p>\n<p><img loading=\"lazy\" class=\"alignnone size-medium wp-image-222\" src=\"\/wp-content\/uploads\/2020\/07\/pointer4-300x71.png\" alt=\"\" width=\"300\" height=\"71\" srcset=\"\/wp-content\/uploads\/2020\/07\/pointer4-300x71.png 300w, \/wp-content\/uploads\/2020\/07\/pointer4.png 501w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/p>\n<p style=\"text-align: justify;\">Comment is enough for explanation of the above program. if arise any confusion, can comment in comment section. Hope you understand.<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\/\/pointer2 #include&lt;stdio.h&gt; void main() { int *p[10]; \/\/it is an array of 10 pointers that is there are 10 pointer &hellip; <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[9],"tags":[],"_links":{"self":[{"href":"http:\/\/suryaprakash.com.np\/index.php?rest_route=\/wp\/v2\/posts\/221"}],"collection":[{"href":"http:\/\/suryaprakash.com.np\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/suryaprakash.com.np\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/suryaprakash.com.np\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/suryaprakash.com.np\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=221"}],"version-history":[{"count":7,"href":"http:\/\/suryaprakash.com.np\/index.php?rest_route=\/wp\/v2\/posts\/221\/revisions"}],"predecessor-version":[{"id":249,"href":"http:\/\/suryaprakash.com.np\/index.php?rest_route=\/wp\/v2\/posts\/221\/revisions\/249"}],"wp:attachment":[{"href":"http:\/\/suryaprakash.com.np\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=221"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/suryaprakash.com.np\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=221"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/suryaprakash.com.np\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=221"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}