I think creatorul's code was the nicest (even though I probably would have used strings), if you just first determine number of digits you will not need to resize the array:
PHP Code:int no=1234;
int len=(int)Math.Ceiling(Math.Log10(no));
int[] digits=new int[len];
int parseNo=no;
for (int i=0;i<len;++i)
{
digits[len-i-1]=parseNo % 10;
parseNo /= 10;
}




Reply With Quote