I've corrected a few things and made it more readable (IMO), see if this code will satisfy.
#include "stdio.h"
#include "windows.h"
size_t memavail(void)
{
return GetFreeSpace(0);
}
typedef unsigned long grant;
char gucmp(const grant * number1, const grant * number2)
{
if (number1[1] > number2[1])
return 1;
else if (number1[1] < number2[1])
return -1;
else if ((number1[0]) > (number2[0]))
return 1;
else if ((number1[0]) < (number2[0]))
return -1;
else
return 0;
}
char *stristalk(const char *string, const char sim)
{
unsigned char *substr = (unsigned char *)(string + strlen(string));
while ((void *)substr != (void *)string)
{ // BUG !
substr--;
if (*substr > (unsigned char)sim)
return (char *)substr;
};
return NULL;
}
char *test = "y bug\t!";
int main(void)
{
grant x[2] = { 1, 1 }, y[2] = { 2, 2 };
puts(stristalk(test, 'x'));
while (gucmp(x, y) > 0){}
return 0;
}
John