According to the gods of SMTP, Jason Duerstock wrote: > Unless my brain has turned to jello lately, Hmm... sounds like me, lately. :) > a = (int *) a; > dereferences null, thus causing your program to go kerfloom. Actually, (int *)a isn't dereferencing a, it's typecasting it. > > int x1,x2,x3; > > int y1,y2,y3; > > unsigned int P; > > unsigned int S; > > void *a; > > > > a = (void *)0; > > x1=20,x2=0,x3=0; > > y1=5, y2=0,y3=0; > > P = 1; > > S = 348; > > > > a = (int *)a +(x2-x1-x3)*P + (y2-y1-y3)*S; Hmm. This should be equivalent to: a = 0 + -20 * 1 + -5 * 348. That should be a = -1760, assuming the type promotion that's going on there is working as expected. sizeof( int* ) should be 8, whereas sizeof( unsigned int ) should be 4. I can't remember the promotion rules for C (and I'm not sure I ever knew them for pointers :) but are the unsigned ints getting promoted to int*, or is the int* getting demoted to 32 bits? Or, even worse, is nothing happening at all, and bits are being lost during the operation? Perhaps you could try: a = (int *)a +(int *)((x2-x1-x3)*P) + (int*)((y2-y1-y3)*S); ..to force the unsigned ints to get promoted. Alternatively try declaring P and S as unsigned long ints, or as int* ? Dan Morrill Computer Scientist, Physicist If I'm talking out of my arse, please excuse me. :)