Posts Tagged ‘Geoff’s Theorem’

It's My String… June 18, 2009 2 Comments

Okay, I just had way too much fun writing this so I thought I’d post it. It’s exercise 4-1 in K&R2. It’s pretty much “write a function which returns the rightmost index of some character in some string.”

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <stdio.h>
#include <string.h>
 
int strindex(char s[], int t);
 
char mystring[] = "This is my string and I can cry if [...]