My bad, the sprintf is for the second hashing function where we have to write the ASCII values to a string.
To complete this though:
Code:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define SIZE 10
int main (void)
{
char string[50];
int i, sum, address;
scanf("%s", string);
sum = 0;
for(i = 0; i < strlen(string); i++)
sum += (int)string[i];
address = sum % SIZE;
printf("(%d)(%d)\n", sum, address);
system("pause");
return 0;
}
The size is predetermined for our assignment. In this case, we are using 10 to test our collision resolution method