More Hashing Problems

I have been provided a function with certain perimeters that I must use. When I run the code I get "Unhandled exception at 0x0020129d in LabShell.exe: 0xC0000094: Integer division by zero." But I don't see whee I am dividing by zero.
Any help would be cool.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
void Hash(int *dta, int n, int &counter, int *&HashTable, int &TableSize, int swch)
{
int m = 1; // m starts at zero for each new data element. 
	// index is the spot where the data wants to go but if it can't I have have to increment m in a while loop and inset x into HashTable[ index ] 
	int index = 0;
	for ( int pass = 0; pass < 3; pass++ )  // this is the outer loop
	{
	      for( int i = 0; i < n; i++ ) 
		{
		int x = dta[i];
		switch( swch )
			{
			case 0:
				{
					HashTable[ index ] = ( dta[ i ] % TableSize + m ) % TableSize;
					counter++;
				}
				break;
			case 1:
				{ 
					HashTable[ index ] = ( dta[ i ] % TableSize + m * m ) % TableSize;
					counter++;
				}
				break;
			case 2:
				{
					HashTable[ index ] = ( dta[ i ] % TableSize + m * ( R - dta[ i ] % R ) % TableSize );
					counter++;
				}
				break;
			};

		}
	}
	return;
}

Thanks for the input,
Pooshi
Topic archived. No new replies allowed.