<?xml version="1.0" encoding="utf-8" ?>
				<!-- generator="e107" -->
				<!-- content type="Forum / topic" -->
				<rdf:RDF xmlns="http://purl.org/rss/1.0/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:admin="http://webns.net/mvcb/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
				<channel rdf:about="http://www.8051projects.net/">
				<title>8051 Microcontroller Projects AVR PIC Projects Tutorials Ebooks Libraries codes : Forum / topic</title>
				<link>http://www.8051projects.net/</link>
				<description>Learn to make simple microcontroller projects, pic, 8051, avr and arm projects. download 8051 projects, tutorials, libraries, sample codes. join the microcontroller discussion forum and ask doubts regarding electronics. the best source for 8051 over internet.</description>
				<dc:language>en-gb</dc:language>
				<dc:date>2009-01-08T05:04:50-08:00</dc:date>
				<dc:creator>contact@nospam.com</dc:creator>
				<admin:generatorAgent rdf:resource="http://e107.org" />
				<admin:errorReportsTo rdf:resource="mailto:contact@nospam.com" />
				<sy:updatePeriod>hourly</sy:updatePeriod>
				<sy:updateFrequency>1</sy:updateFrequency>
				<sy:updateBase>2000-01-01T12:00+00:00</sy:updateBase>
				<items>
				<rdf:Seq>
						<rdf:li rdf:resource="http://www.8051projects.net/forum-t11647.html" />
						<rdf:li rdf:resource="http://www.8051projects.net/forum-t11647.html" />
						<rdf:li rdf:resource="http://www.8051projects.net/forum-t11647.html" />
						<rdf:li rdf:resource="http://www.8051projects.net/forum-t11647.html" />
						<rdf:li rdf:resource="http://www.8051projects.net/forum-t11647.html" />
						<rdf:li rdf:resource="http://www.8051projects.net/forum-t11647.html" />
						<rdf:li rdf:resource="http://www.8051projects.net/forum-t11647.html" />
						<rdf:li rdf:resource="http://www.8051projects.net/forum-t11647.html" />
				</rdf:Seq>
				</items>
				</channel>
						<item rdf:about="http://www.8051projects.net/forum-t11647.html">
						<title>return 0 vs return 1</title>
						<link>http://www.8051projects.net/forum-t11647.html</link>
						<dc:date>2009-01-08T05:04:50-08:00</dc:date>
						<dc:creator></dc:creator>
						<dc:subject></dc:subject>
						<description>Does anyone knows what does return 1 does?</description>
						</item>
						<item rdf:about="http://www.8051projects.net/forum-t11647.html">
						<title>Re: return 0 vs return 1</title>
						<link>http://www.8051projects.net/forum-t11647.html</link>
						<dc:date>2009-01-08T05:04:50-08:00</dc:date>
						<dc:creator>shyam</dc:creator>
						<dc:subject></dc:subject>
						<description>suppose u have a fun say addyou can use return as follows..CODE:<br />int add&#40;void&#41;;<br />main&#40;&#41;<br />&#123;<br />printf&#40;"sum of 2 and 3 is %d ",add&#40;&#41;&#41;;<br />&#125;<br />int add&#40;void&#41;<br />&#123;<br />return 5;<br />&#125;thus we can say return 1 returns a 1</description>
						</item>
						<item rdf:about="http://www.8051projects.net/forum-t11647.html">
						<title>Re: return 0 vs return 1</title>
						<link>http://www.8051projects.net/forum-t11647.html</link>
						<dc:date>2009-01-08T05:04:50-08:00</dc:date>
						<dc:creator>Ajay</dc:creator>
						<dc:subject></dc:subject>
						<description>In programming language, return 0 and return 1 are used to return the status of function.return 0</description>
						</item>
						<item rdf:about="http://www.8051projects.net/forum-t11647.html">
						<title>Re: return 0 vs return 1</title>
						<link>http://www.8051projects.net/forum-t11647.html</link>
						<dc:date>2009-01-08T05:04:50-08:00</dc:date>
						<dc:creator>say2paul</dc:creator>
						<dc:subject></dc:subject>
						<description>The return statementA return statement ends the processing of the current function and returns control to the caller of the function.CODE:<br />>>-return--+--------------------------+--;--------------------->&lt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;'-+---+--expression--+---+-'<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;'-(-' &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;'-)-'<br />&nbsp; A value-returning function should include a return statement, containing an expression. C only If an expression is not given on a return statement in a function declared with a non-void return type, the compiler issues a warning message. C++ If an expression is not given on a return statement in a function declared with a non-void return type, the compiler issues an error message.If the data type of the expression is different from the function return type, conversion of the return value takes place as if the value of the expression were assigned to an object with the same function return type.For a function of return type void, a return statement is not strictly necessary. If the end of such a function is reached without encountering a return statement, control is passed to the caller as if a return statement without an expression were encountered. In other words, an implicit return takes place upon completion of the final statement, and control automatically returns to the calling function. C++ If a return statement is used, it must not contain an expression.Examples of return statementsThe following are examples of return statements:CODE:<br />return; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;/* Returns no value &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*/<br />return result; &nbsp; &nbsp; /* Returns the value of result */<br />return 1; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;/* Returns the value 1 &nbsp; &nbsp; &nbsp; &nbsp; */<br />return &#40;x * x&#41;; &nbsp; &nbsp;/* Returns the value of x * x &nbsp;*/<br />&nbsp;The following function searches through an array of integers to determine if a match exists for the variable number. If a match exists, the function match returns the value of i. If a match does not exist, the function match returns the value -1 (negative one).CODE:<br />int match&#40;int number, int array&#91; &#93;, int n&#41;<br />&#123;<br />&nbsp; &nbsp;int i;<br /><br />&nbsp; &nbsp;for &#40;i = 0; i &lt; n; i++&#41;<br />&nbsp; &nbsp; &nbsp; if &#40;number == array&#91;i&#93;&#41;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;return &#40;i&#41;;<br />&nbsp; &nbsp;return&#40;-1&#41;;<br />&#125;<br />&nbsp;A function can contain multiple return statements. For example:CODE:<br />void copy&#40; int *a, int *b, int c&#41;<br />&#123;<br />&nbsp; &nbsp;/* Copy array a into b, assuming both arrays are the same size */<br /><br />&nbsp; &nbsp;if &#40;!a || !b&#41; &nbsp; &nbsp; &nbsp; /* if either pointer is 0, return */<br />&nbsp; &nbsp; &nbsp; return;<br /><br />&nbsp; &nbsp;if &#40;a == b&#41; &nbsp; &nbsp; &nbsp; &nbsp; /* if both parameters refer */<br />&nbsp; &nbsp; &nbsp; return; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;/* &nbsp; &nbsp;to same array, return */<br /><br />&nbsp; &nbsp;if &#40;c == 0&#41; &nbsp; &nbsp; &nbsp; &nbsp; /* nothing to copy */<br />&nbsp; &nbsp; &nbsp; return;<br /><br />&nbsp; &nbsp;for &#40;int i = 0; i &lt; c; ++i;&#41; /* do the copying */<br />&nbsp; &nbsp; &nbsp; b&#91;i&#93; = a&#91;1&#93;;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;/* implicit return */<br />&#125;<br />&nbsp;In this example, the return statement is used to cause a premature termination of the function, similar to a break statement.An expression appearing in a return statement is converted to the return type of the function in which the statement appears. If no implicit conversion is possible, the return statement is invalid.Source: XL C/C++ V8.0 IBM</description>
						</item>
						<item rdf:about="http://www.8051projects.net/forum-t11647.html">
						<title>Re: return 0 vs return 1</title>
						<link>http://www.8051projects.net/forum-t11647.html</link>
						<dc:date>2009-01-08T05:04:50-08:00</dc:date>
						<dc:creator>pdi33</dc:creator>
						<dc:subject></dc:subject>
						<description>Another interesting application of the return function is when it is used in the main() function. Here the return (value) returns the value to the operating system which is used by the operating system for its own use (especially when unix operating system is used.)but this feature is not applicable in our real time embedded system where the control never reaches the return statement.</description>
						</item>
						<item rdf:about="http://www.8051projects.net/forum-t11647.html">
						<title>Re: return 0 vs return 1</title>
						<link>http://www.8051projects.net/forum-t11647.html</link>
						<dc:date>2009-01-08T05:04:50-08:00</dc:date>
						<dc:creator>nismo</dc:creator>
						<dc:subject></dc:subject>
						<description>very clear   no wonder my lecturer told me India has a lot of good programmers.. Thanks</description>
						</item>
						<item rdf:about="http://www.8051projects.net/forum-t11647.html">
						<title>Re: return 0 vs return 1</title>
						<link>http://www.8051projects.net/forum-t11647.html</link>
						<dc:date>2009-01-08T05:04:50-08:00</dc:date>
						<dc:creator>nismo</dc:creator>
						<dc:subject></dc:subject>
						<description>void copy( int *a, int *b, int c){   /* Copy array a into b, assuming both arrays are the same size */   if (!a || !b)       /* if either pointer is 0, return */      return;   if (a == b)         /* if both parameters refer */      return;          /*    to same array, return */   if (c == 0)         /* nothing to copy */      return;   for (int i = 0; i &lt; c; ++i;) /* do the copying */      b[i] = a[1];                       /* implicit return */} Yoyo, Mr say2paul... what does the return does in this routine? Does it mean return to the main function?</description>
						</item>
						<item rdf:about="http://www.8051projects.net/forum-t11647.html">
						<title>Re: return 0 vs return 1</title>
						<link>http://www.8051projects.net/forum-t11647.html</link>
						<dc:date>2009-01-08T05:04:50-08:00</dc:date>
						<dc:creator>pdi33</dc:creator>
						<dc:subject></dc:subject>
						<description>hi nismo,well, if u have called the function copy ( ) from the main function, then it will return back to the main function. but if the function was called by another function say abc() then the control will return to that function.case1: calling from main functionmain(){.copy (....);.   &lt;-------   control will return here.}case2: calling from another functionmain(){..abc(...);..}abc(){..copy();.       &lt;------   control will return here.}</description>
						</item>
				</rdf:RDF>