Originally Posted by
laserlight
Ah, now the problem becomes clearer :)
digits is not an integer array. It is a pointer to an int that you presumably want to point to the first integer of a dynamically allocated integer array.
Unfortunately, your sample program is not compilable, so it is hard to see where exactly the access violation might lie because there are more important errors to fix, i.e., the compile errors. My guess is that the access violation is directly related to the fact that digits is a pointer, not an array, so you ended up accessing memory that you do not own.
This is why I suggested that the program that you posted be compilable: when we have a program that is free of compile errors, it is easier to zoom in to the spot that might be the underlying reason for the access violation.