Hi guys,
I am trying to make a hashing function that will accept a string and output an integer. On this forum I found this code (made by Salem) which adds up the ASCII values of the letters.
Code:char string[] = "Bob Jones"; int hash ( const char *string ) { int result = 0; while ( *string ) result += *string++; return result; }
It works fine for using character array stings, however, I would prefer to use a string declared as..
Is there anyway to accomplish the same thing using strings?Code:string name = "Bob Jones";