void star to char star star
Posted on 2005-05-02
Can someone explain when and why a void star needs to be converted to a char star star? The actual parameter s is a char *, and the formal parameter s is (obviously) a void *. However, I seem to remember that the void star needs to be a char star star, because it's a string that's being passed in. Here's an example of what I'm doing (I don't know if it's correct)
static int test(const void *s, int numBuckets)
int i, num;
for (i = 0; i < strlen((char *)(char *)s); i++)
num = num + tolower((char *)s + i);
Is this correct? void *s is being passed a string.