<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>what is an array in c plus plus - Wikitechy</title>
	<atom:link href="https://www.wikitechy.com/interview-questions/tag/what-is-an-array-in-c-plus-plus/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.wikitechy.com/interview-questions/tag/what-is-an-array-in-c-plus-plus/</link>
	<description>Interview Questions</description>
	<lastBuildDate>Fri, 30 Sep 2022 09:33:22 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>https://www.wikitechy.com/interview-questions/wp-content/uploads/2025/10/cropped-wikitechy-icon-32x32.png</url>
	<title>what is an array in c plus plus - Wikitechy</title>
	<link>https://www.wikitechy.com/interview-questions/tag/what-is-an-array-in-c-plus-plus/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>What is Array in C ?</title>
		<link>https://www.wikitechy.com/interview-questions/c/what-is-array-in-c/</link>
					<comments>https://www.wikitechy.com/interview-questions/c/what-is-array-in-c/#respond</comments>
		
		<dc:creator><![CDATA[webmaster]]></dc:creator>
		<pubDate>Fri, 30 Sep 2022 09:33:22 +0000</pubDate>
				<category><![CDATA[C]]></category>
		<category><![CDATA[array in c]]></category>
		<category><![CDATA[array in c programming examples]]></category>
		<category><![CDATA[how do you initialize an array in c]]></category>
		<category><![CDATA[multidimensional array in c]]></category>
		<category><![CDATA[one dimensional array in c]]></category>
		<category><![CDATA[string array in c]]></category>
		<category><![CDATA[syntax of array]]></category>
		<category><![CDATA[what is an array base address in c language]]></category>
		<category><![CDATA[what is an array in c]]></category>
		<category><![CDATA[what is an array in c language]]></category>
		<category><![CDATA[what is an array in c plus plus]]></category>
		<category><![CDATA[what is an array in c programming]]></category>
		<category><![CDATA[what is an array in c++ with example]]></category>
		<category><![CDATA[what is the maximum number of dimensions an array in c]]></category>
		<guid isPermaLink="false">https://www.wikitechy.com/interview-questions/?p=4882</guid>

					<description><![CDATA[Arrays are defined as collection of similar type of data items that is stored at consecutive blocks of memory locations. Arrays are deprived data types which can store primitive data types such as int, char, float, double etc. Arrays are also used to store pointers and structures in C. Arrays are considered as simplest data [&#8230;]]]></description>
										<content:encoded><![CDATA[<ul>
<li>Arrays are defined as collection of similar type of data items that is stored at consecutive blocks of memory locations.</li>
<li>Arrays are deprived data types which can store primitive data types such as int, char, float, double etc.</li>
<li>Arrays are also used to store pointers and structures in C.</li>
<li>Arrays are considered as simplest data structure where each data element can be randomly accessed using its index numbers.</li>
<li>Array index starts from 0 to n number of elements.</li>
<li>Array Size once fixed cannot be changed in the program.</li>
</ul>
<h2 id="properties-of-array"><strong>Properties of Array</strong></h2>
<ul>
<li style="text-align: justify;">Each element in the array is of the same data type of which the array is declared.</li>
<li style="text-align: justify;">Array carries the same size int = 4bytes.</li>
<li style="text-align: justify;">Elements in array are arranged in a consecutive blocks of memory at memory locations.</li>
<li style="text-align: justify;">The first element in the array is stored at the smallest memory location.</li>
<li style="text-align: justify;">Elements of the array can be randomly accessed since we calculate the index of each element of the array with the given base address and the size of the element.</li>
</ul>
<p><img fetchpriority="high" decoding="async" class="alignnone size-full wp-image-4884 aligncenter" src="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/09/c-array.jpg" alt="" width="471" height="193" srcset="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/09/c-array.jpg 471w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/09/c-array-300x123.jpg 300w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/09/c-array-390x160.jpg 390w" sizes="(max-width: 471px) 100vw, 471px" /></p>
<h2 id="advantages-of-array"><strong>Advantages of Array</strong></h2>
<ul>
<li style="text-align: justify;"><strong>Arrays </strong>use less code for code effectiveness.</li>
<li style="text-align: justify;">By using the  loop, we can retrieve the elements of an array easily.</li>
<li style="text-align: justify;">To sort the elements of the array, we need a few lines of code only.</li>
<li style="text-align: justify;">We can access any element randomly using the array.</li>
</ul>
<p><img decoding="async" class="alignnone size-full wp-image-4883" src="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/09/array-in-c.jpg" alt="" width="553" height="428" srcset="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/09/array-in-c.jpg 553w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/09/array-in-c-300x232.jpg 300w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/09/array-in-c-390x302.jpg 390w" sizes="(max-width: 553px) 100vw, 553px" /></p>
<h2 id="declaration-of-c-array"><strong>Declaration of C Array</strong></h2>
<p style="background: white;"><span lang="EN-US" style="font-size: 16.0pt; font-family: 'Segoe UI',sans-serif; color: #333333;">We can declare an array in the c language as below</span></p>
<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">data_type array_name[array_size];  </code></pre> </div>
<p style="text-align: justify; background: white;"><span lang="EN-US" style="font-size: 16.0pt; font-family: 'Segoe UI',sans-serif; color: #333333;">Now, let us see the example to declare the array.</span></p>
<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 marks[5];  </code></pre> </div>
<p style="text-align: justify; background: white;"><span lang="EN-US" style="font-size: 16.0pt; font-family: 'Segoe UI',sans-serif; color: #333333;">Here, int is the <em><span style="font-family: 'Segoe UI',sans-serif;">data_type</span></em>, marks are the <em><span style="font-family: 'Segoe UI',sans-serif;">array_name</span></em>, and 5 is the <em><span style="font-family: 'Segoe UI',sans-serif;">array_size</span></em>.</span></p>
<h2 id="initialization-of-c-array" style="text-align: justify;"><strong>Initialization of C Array</strong></h2>
<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 simplest way to initialize an array is by using the index of each element. We can initialize each element of the array by using the index. Consider the following example.</span></p>
<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">marks[0]=80;//initialization of array  <br/>marks[1]=60;  <br/>marks[2]=70;  <br/>marks[3]=85;  <br/>marks[4]=75;  </code></pre> </div>
<p style="text-align: justify; background: white;"><span lang="EN-US" style="font-size: 16.0pt; font-family: 'Segoe UI',sans-serif; color: #333333;">Pictorial representation of array initialization</span></p>
<p><img decoding="async" class="alignnone size-full wp-image-4886" src="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/09/c-array-initialization.jpg" alt="" width="355" height="80" srcset="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/09/c-array-initialization.jpg 355w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/09/c-array-initialization-300x68.jpg 300w" sizes="(max-width: 355px) 100vw, 355px" /></p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.wikitechy.com/interview-questions/c/what-is-array-in-c/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
