hello all, this is my first time posting. Okay, I'm reading a character array from a .dat file. The character array has 6 elements and I'm supposed to fold the integer values of the character array. The professor wants us to pair up consecutive indexes and add them together. For ex: "ABCDEF" would be 6566 + 6768 + 6970. This is part of an assignment to create a hash table.
Could someone please tell me how to fold the character array in this manner?

May be this code sample will be of some help.Just have a look at it.

/***** required macros and structures *****************/
union example
	char array[6];
	struct ints
		short a;
		short b;
		short c;

union example e1;
#define swapbytes(z) (((short)(z << 8)) | ((short)(z >> 8)))

/********************example code snippet ****************/
int main(int argc, char* argv[])

	printf ("value of array = %s\n",e1.array);
	printf("value of a = %X\n",swapbytes(e1.x.a));
	printf("value of b = %X\n",swapbytes(e1.x.b));
	printf("value of c = %X\n",swapbytes(e1.x.c));
	printf("value of a + b  + c = %X\n",swapbytes(e1.x.a) + swapbytes(e1.x.b) + swapbytes(e1.x.c));
	printf("Hello World!\n");
	return 0;

Code tags added. -Narue