Ok, a few things.
the most obvious thing is
GeSHi (c):
while ((character_pointer!=NULL) && (index = string1 - character_pointer)) {Created by GeSHI 1.0.7.18
the "index = string1 - character_pointer" part isn't a Boolean expression and shouldn't be used with "&&"
I'm hoping you meant "index == string1 - character_pointer" but if you use that then you haven't initialized your index.
Second from reading your code i gather that you haven't realized that a string is the same thing as a character pointer
for example
GeSHi (c):
char string[] = "This is a test string";Created by GeSHI 1.0.7.18
and
GeSHi (c):
char *string = "This is a test string";Created by GeSHI 1.0.7.18
do exactly the same thing and on most compilers you can interchange the notation
example
GeSHi (c):
return string[5];Created by GeSHI 1.0.7.18
and
GeSHi (c):
return *(string + 5);Created by GeSHI 1.0.7.18
should be the same.
So this means that if your "string1 - character_pointer" returns a negative result then you have to handle an error condition not multiply it by -1.
Also as a general rule of thumb avoid using multiplication or division directly on pointers, the results probably won't be what you expect.
about the only time you should be using multiplication in/on/with a pointer is for cases like the following
GeSHi (c):
int array[] = {0,1,2,3,4,5,6,7,8,9};
return *(array + (sizeof(int) * 5));Created by GeSHI 1.0.7.18
Also most compilers handle bool like int's. The rules for a bool are simple if the bool (int) results to 0 then it's false if it's anything else it's true
so
GeSHi (c):
if (-4356)Created by GeSHI 1.0.7.18
is always true
if your above code works this is why, because "string1 - character_pointer" evaluates to a non-zero value then passes it to index. Because of a property of assignment where you can use "a = b = c;" this will pass the value that "string1 - character_pointer" returned to your "&&". I think you should test your code and see what happens when you have an 's' as the first character of string1, I'll bet it will fail by exiting the loop immediately without doing anything.
Also pointer sizes depend on the architecture your working on for example
if your working with an 8 bit compiler then a pointer will be 1 byte wide probably be the same size as a char (you probably wont ever work with one of these)
if it's a 16 bit compiler your pointers will be 2 bytes wide
if it's a 32 bit compiler it your pointers will be 4 bytes wide the same size as an int
This means in general you want to avoid on relining on a pointer being the same as an int, granted you can work with them that way, but I don't think anyone recommends it.
As for your index value i would consider it like a local pointer for use inside your string, so the rule for using multiplication on it should apply.