<?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>Funcion parameters | Student Projects</title>
	<atom:link href="https://studentprojects.in/tag/funcion-parameters/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:23:28 +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>Function Parameters</title>
		<link>https://studentprojects.in/software-development/c-tutorials/c-tutorials-c-tutorials/function-parameters/</link>
					<comments>https://studentprojects.in/software-development/c-tutorials/c-tutorials-c-tutorials/function-parameters/#respond</comments>
		
		<dc:creator><![CDATA[Shubhajna Rai]]></dc:creator>
		<pubDate>Tue, 25 Oct 2022 08:37:32 +0000</pubDate>
				<category><![CDATA[C Tutorials]]></category>
		<category><![CDATA[Funcion parameters]]></category>
		<category><![CDATA[return type]]></category>
		<category><![CDATA[define a function]]></category>
		<guid isPermaLink="false">https://studentprojects.in/?p=9687</guid>

					<description><![CDATA[<p>The data we want to send to a function when it is called to be executed is known as an argument or a parameter of the function. Within the function, parameters function as variables. After the function name, parameters are listed between parentheses. You can enter as many options as you like; simply comma-separate them.</p>
<p>The post <a href="https://studentprojects.in/software-development/c-tutorials/c-tutorials-c-tutorials/function-parameters/">Function Parameters</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></description>
										<content:encoded><![CDATA[<p>The data we want to send to a function when it is called to be executed is known as an argument or a parameter of the function. Within the function, parameters function as variables. After the function name, parameters are listed between parentheses. You can enter as many options as you like; simply comma-separate them. Here is a function&#8217;s fundamental syntax.</p>



<p>return_type functionName(parameter1, parameter2) {</p>



<p>&nbsp; // body of the function</p>



<p>}</p>



<p><strong>What is the return type?</strong></p>



<ul><li>The data type the function should return once it has been executed is specified by the return type. In cases where the function must return nothing, it may also be a void.</li></ul>



<p><strong>Different ways to define a function</strong></p>



<p><strong>1.Without arguments and without return value</strong></p>



<ul><li>In this function, we are not required to provide the function with any value (arguments or parameters) and are not even required to get any value in return.</li></ul>



<p>One illustration of such features might be,</p>



<pre class="wp-block-code"><code class="">#include &lt;stdio.h&gt;
void func()
{
    printf("This function doesn't return anything.");
}
 
int main()
{
    func();
}
</code></pre>



<p>Output: This function doesn’t return anything.</p>



<p><strong>2.Without arguments and with the return value.</strong></p>



<ul><li>In these kinds of functions, we don&#8217;t need to provide the function with any values or arguments, but in exchange, we receive something from it, i.e. some value.</li></ul>



<p>One illustration of such features would be</p>



<pre class="wp-block-code"><code lang="csharp" class="language-csharp">#include &lt;stdio.h&gt;
int func()
{
    int a, b;
    scanf("%d", &amp;a);
    scanf("%d", &amp;b);
    return a + b;
}
 
int main()
{
    int ans = func();
    printf("%d", ans);
}</code></pre>



<p>Input:8,5</p>



<p>Output:13</p>



<p><strong>3.With arguments and without a return value.</strong></p>



<ul><li>In this kind of function, we supply the function with arguments or parameters, but we receive nothing in return.</li></ul>



<p>One illustration of such features might be,</p>



<pre class="wp-block-code"><code class="">#include &lt;stdio.h&gt;
 
void func(int a, int b)
{
    printf("%d", a * b);
}
 
int main()
{
    func(2, 3);
}</code></pre>



<p>Output:6</p>



<p><strong>4.With arguments and with the return value</strong></p>



<ul><li>In these functions, we pass arguments to a function and receive a value back in return.</li></ul>



<p>One illustration of such features might be,</p>



<pre class="wp-block-code"><code class="">#include &lt;stdio.h&gt; 
int func(int a, int b)
{
    return a + b;
}
 
int main()
{
    int ans = func(2, 3);
    printf("%d", ans);
}</code></pre>



<p>Output:5</p><p>The post <a href="https://studentprojects.in/software-development/c-tutorials/c-tutorials-c-tutorials/function-parameters/">Function Parameters</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/function-parameters/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
