1. Short Sorting Problem

I am having trouble debugging my segmentation fault error in this short code!

Code:
```void radixsort(unsigned long array[]){
int arraysize = sizeof(array)/sizeof(*array);
unsigned long move[arraysize];
while(index<4){
for(i=0;i<arraysize;i++){
val=array[i]>>(index*group);
}
for(i=1;i<256;i++){
map[i]=map[i-1]+count[i-1];
}
for(i=0;i<arraysize;i++){
val=array[i]>>(index*group);
}
index++;
}
array = move;
}```

2. You don't initialize "count" and "map".

Bye, Andreas

3. This may be a dumb question but is there an easy way to initialize without using a simple for loop and setting everything to 0?

4. Code:
```int main(void)
{
int array[5] = { 1,1,1,1,1 };

return 0;
}```
I think you see while the loops are so beloved by many (including me)

5. Originally Posted by workisnotfun
This may be a dumb question but is there an easy way to initialize without using a simple for loop and setting everything to 0?
If you want to set every element to 0 try
Code:
`int count[256] = { 0 }, map[256] = { 0 };`
By default, all missing elements in an initializer list are set to 0 by the compiler.

Bye, Andreas

6. Thanks for the tip, the seg fault's fixed. On another note, is there something wrong with my sorting logic or is the parameter suppose to be a pointer to an array? When I print the values of my array before and after calling this function, the values are in the same place, unmoved.
Code:
``` unsigned long j[size];
argv++;
for(i=0;i<size;i++){
j[i]=atoi(*argv++);
}
`int count[256] = {}, map[256] = {};`