the ssFind is suppose to return the starting character position of toFind within src, if src does not contain toFind, 0 is returned.
AM i close or way off? Im suppose to be indexing based on 1, and im utterly confused why it doesn't compile. I know im a newb and any hints on whats wrong with it is greatly appreciated. Thanks!
Code:
#include <stdio.h>
#include <string.h>
#include "sstring.h"
int main()
{
long ssFind(String *src, String *toFind);{
int i;
int j;
char a, b;
(src->data)[i];
(toFind->data)[j];
for (i = 1; i <(src->length); i++)
a = (src->data)[1];
for (j = 1;j<i; j++)
b = (toFind->data)[1];
if(char *strstr(char *src,char *toFind))
return b;
else
return 0;
}
}
and the string.h file is this
Code:
#include <string.h>
struct sstring {
size_t length;
size_t maxlength;
char *data;
} ;
typedef struct sstring String;
String ........New(size_t len);
void ........Free(String *s);
String ........Check(String *s, size_t len);
String ........Init(String *s, char *chrs);
size_t ........Count(String *s, char *delims);