<?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>Math + CS = 11 &#187; Delicious Library 2</title>
	<atom:link href="http://geoffsquared.com/tag/delicious-library-2/feed/" rel="self" type="application/rss+xml" />
	<link>http://geoffsquared.com</link>
	<description>Because Orange \gg Green</description>
	<lastBuildDate>Tue, 09 Mar 2010 20:04:07 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>It&#039;s My String&#8230;</title>
		<link>http://geoffsquared.com/2009/06/its-my-string/#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed</link>
		<comments>http://geoffsquared.com/2009/06/its-my-string/#comments</comments>
		<pubDate>Thu, 18 Jun 2009 09:44:16 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[awesome]]></category>
		<category><![CDATA[bar codes]]></category>
		<category><![CDATA[C]]></category>
		<category><![CDATA[Delicious Library 2]]></category>
		<category><![CDATA[fun]]></category>
		<category><![CDATA[Geoff's Theorem]]></category>
		<category><![CDATA[K&R2]]></category>
		<category><![CDATA[orange]]></category>
		<category><![CDATA[Shoes]]></category>
		<category><![CDATA[Zappos]]></category>

		<guid isPermaLink="false">http://geoffsquared.com/?p=104</guid>
		<description><![CDATA[Okay, I just had way too much fun writing this so I thought I&#8217;d post it. It&#8217;s exercise 4-1 in K&#038;R2. It&#8217;s pretty much &#8220;write a function which returns the rightmost index of some character in some string.&#8221;

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include &#60;stdio.h&#62;
#include &#60;string.h&#62;
&#160;
int strindex&#40;char s&#91;&#93;, int t&#41;;
&#160;
char mystring&#91;&#93; = &#34;This is my string and I can cry if [...]]]></description>
			<content:encoded><![CDATA[<p>Okay, I just had way too much fun writing this so I thought I&#8217;d post it. It&#8217;s exercise 4-1 in K&#038;R2. It&#8217;s pretty much &#8220;write a function which returns the rightmost index of some character in some string.&#8221;</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
</pre></td><td class="code"><pre class="c" style="font-family:monospace;"><span style="color: #339933;">#include &lt;stdio.h&gt;</span>
<span style="color: #339933;">#include &lt;string.h&gt;</span>
&nbsp;
<span style="color: #993333;">int</span> strindex<span style="color: #009900;">&#40;</span><span style="color: #993333;">char</span> s<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #993333;">int</span> t<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #993333;">char</span> mystring<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;This is my string and I can cry if I want to.&quot;</span><span style="color: #339933;">;</span>
&nbsp;
main<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
    <span style="color: #993333;">int</span> mychar <span style="color: #339933;">=</span> <span style="color: #ff0000;">'z'</span><span style="color: #339933;">;</span>
    <span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;%c is at %d in %s<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span> mychar<span style="color: #339933;">,</span> strindex<span style="color: #009900;">&#40;</span>mystring<span style="color: #339933;">,</span> mychar<span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> mystring<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #993333;">int</span> strindex<span style="color: #009900;">&#40;</span><span style="color: #993333;">char</span> s<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #993333;">int</span> t<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
    <span style="color: #993333;">int</span> i<span style="color: #339933;">;</span>
    <span style="color: #b1b100;">for</span><span style="color: #009900;">&#40;</span>i <span style="color: #339933;">=</span> strlen<span style="color: #009900;">&#40;</span>s<span style="color: #009900;">&#41;</span><span style="color: #339933;">-</span><span style="color: #0000dd;">1</span><span style="color: #339933;">;</span> i <span style="color: #339933;">&gt;=</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span> i<span style="color: #339933;">--</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>t <span style="color: #339933;">==</span> s<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span>
            <span style="color: #b1b100;">return</span> i<span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #b1b100;">return</span> <span style="color: #339933;">-</span><span style="color: #0000dd;">1</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>On a somewhat more serious note, I have finally bought some new shoes (yay?) from Zappos.com. They&#8217;re orange and like all orange things, they are good. <strong>Geoff&#8217;s Theorem: If something is orange, then it is good.</strong></p>
<p>Another cool thing that every Mac user should play around with is Delicious Library 2. If you have never heard of it, think of it as a digital book shelf where you can display books, movies, video games, electronics, ect. that you own. The best part is that it lets you use your iSight camera to scan in the bar codes for everything! I got it as part of the Macheist bundle and have never played with it until now and I gotta tell you, scanning everything in is way more fun than it should be.</p>
]]></content:encoded>
			<wfw:commentRss>http://geoffsquared.com/2009/06/its-my-string/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
