<?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>Bread &#38; Cup &#187; programming</title>
	<atom:link href="http://blog.breadncup.com/tag/programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.breadncup.com</link>
	<description></description>
	<lastBuildDate>Sat, 28 Jan 2012 11:25:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Make your own atoi() function in C</title>
		<link>http://blog.breadncup.com/2009/12/21/make-your-own-atoi-function-in-c/</link>
		<comments>http://blog.breadncup.com/2009/12/21/make-your-own-atoi-function-in-c/#comments</comments>
		<pubDate>Tue, 22 Dec 2009 03:51:03 +0000</pubDate>
		<dc:creator>Breadncup</dc:creator>
				<category><![CDATA[Job Interview]]></category>
		<category><![CDATA[c]]></category>
		<category><![CDATA[c programming]]></category>
		<category><![CDATA[interview]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[quiz]]></category>

		<guid isPermaLink="false">http://blog.breadncup.com/?p=225</guid>
		<description><![CDATA[Showing how to make your own atoi() function in C language.]]></description>
			<content:encoded><![CDATA[<p>atoi() is able to translate a string of a number into an integer number. There are lots of tech to do, and here is showing some examples.</p>
<pre class="brush: cpp; title: ; notranslate">
int my_atoi(char *p) {
  int k = 0;
  while (*p) {
    k = k*10 + (*p) - '0';
    p++;
  }
  return k;
}
</pre>
<p>10 times can be switched to bit-wise shift since bit-wise will use smaller instruction set which enables to reduce transistor in a system. Following shows of it.</p>
<pre class="brush: cpp; title: ; notranslate">
int my_atoi(char *p) {
 int k = 0;
 while (*p) {
 k = (k&lt;&lt;3)+(k&lt;&lt;1)+(*p)-'0';
 p++;
 }
 return k;
}
</pre>
 <img src="http://blog.breadncup.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=225" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://blog.breadncup.com/2009/12/21/make-your-own-atoi-function-in-c/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

