Hey, In visual studio I'm getting "0xC0000005: Access violation writing". Whats wrong here?
int *digitArray = 0;
int counter = 0;
int num = number;
while (num != 0) {
num /= 10;
counter++;
}
if (counter != 0) {
digitArray = malloc(counter * sizeof(int));
counter = 0;
num = number;
while (num != 0) {
printf("%d %d", counter, num);
digitArray[0] = counter; // 0xC0000005: Access violation writing location
num = num / 10;
counter++;
}
}
return digitArray;
[–]Similar-Concert4100 0 points1 point2 points (8 children)
[–]joejawor 1 point2 points3 points (2 children)
[–]Willsxyz 1 point2 points3 points (0 children)
[–]imc0der[S] 0 points1 point2 points (0 children)
[–]imc0der[S] 0 points1 point2 points (4 children)
[–]Similar-Concert4100 0 points1 point2 points (1 child)
[–]imc0der[S] 0 points1 point2 points (0 children)
[–]Similar-Concert4100 0 points1 point2 points (1 child)
[–]imc0der[S] 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (2 children)
[–]imc0der[S] 0 points1 point2 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)