<?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>changing array elements | Student Projects</title>
	<atom:link href="https://studentprojects.in/tag/changing-array-elements/feed/" rel="self" type="application/rss+xml" />
	<link>https://studentprojects.in</link>
	<description>Microcontroller projects, Circuit Diagrams, Project Ideas</description>
	<lastBuildDate>Sat, 10 Dec 2022 04:24:01 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.1.7</generator>
	<item>
		<title>Array Operations</title>
		<link>https://studentprojects.in/software-development/c-tutorials/c-tutorials-c-tutorials/array-operations/</link>
					<comments>https://studentprojects.in/software-development/c-tutorials/c-tutorials-c-tutorials/array-operations/#respond</comments>
		
		<dc:creator><![CDATA[Shubhajna Rai]]></dc:creator>
		<pubDate>Tue, 25 Oct 2022 08:10:32 +0000</pubDate>
				<category><![CDATA[C Tutorials]]></category>
		<category><![CDATA[array operation]]></category>
		<category><![CDATA[changing array elements]]></category>
		<category><![CDATA[Accessing an array element]]></category>
		<guid isPermaLink="false">https://studentprojects.in/?p=9676</guid>

					<description><![CDATA[<p>Defining an array Without mentioning the array&#8217;s size int arr[] = {1, 2, 3}; Although the array in this situation cannot be empty, we can leave the square brackets empty. There must be components in it. By defining the array&#8217;s size int arr[3]; arr[0] = 1, arr[1] = 2, arr[2] = 3; In this case,</p>
<p>The post <a href="https://studentprojects.in/software-development/c-tutorials/c-tutorials-c-tutorials/array-operations/">Array Operations</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></description>
										<content:encoded><![CDATA[<p><strong>Defining an array</strong></p>



<ol type="1"><li>Without mentioning the array&#8217;s size</li></ol>



<p>int arr[] = {1, 2, 3};</p>



<p>Although the array in this situation cannot be empty, we can leave the square brackets empty. There must be components in it.</p>



<ul><li>By defining the array&#8217;s size</li></ul>



<p>int arr[3];</p>



<p>arr[0] = 1, arr[1] = 2, arr[2] = 3;</p>



<p>In this case, the array&#8217;s definition itself allows us to specify its size. The items of an array can then be added afterwards.</p>



<p><strong>Accessing an array element</strong></p>



<ul><li>The index number of an array element makes it simple to access that element. It is important to keep in mind that the index number actually begins at zero, not one.</li></ul>



<pre class="wp-block-code"><code lang="c" class="language-c">#include &lt;stdio.h&gt;
int main()
{

    int arr[] = {1, 5, 7, 2};

    printf("%d ", arr[2]); //printing element on index 2

}</code></pre>



<p>Output:7</p>



<p>Changing an array element</p>



<ul><li>Using an array&#8217;s index number, an element can be replaced.</li></ul>



<p>Example:</p>



<pre class="wp-block-code"><code lang="c" class="language-c">#include &lt;stdio.h&gt;
int main()
{

    int arr[] = {1, 5, 7, 2};

    arr[2] = 8; //changing the element on index 2

    printf("%d ", arr[2]); //printing element on index 2

}</code></pre>



<p>Output:8</p><p>The post <a href="https://studentprojects.in/software-development/c-tutorials/c-tutorials-c-tutorials/array-operations/">Array Operations</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://studentprojects.in/software-development/c-tutorials/c-tutorials-c-tutorials/array-operations/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
