Originally Posted By: Reconnoiter
Code:
//make array start with null values
 j = 1;
 for(i=1; j<5; i++) 
 {
  pointer_pan[j][i] = NULL;
  if (i >= 30) { j += 1; i = 1; }
 }



You are only doing five iterations here. Also, make sure to follow a ptr_remove() up by also setting the pointer to NULL, or else it will continue to hold garbage.


Originally Posted By: Reconnoiter
for me it sounds more logical beginning with 1 than 0 tongue .

It does not!
The reason it starts with zero as opposed to 1 is because it's an offset into the memory. The first element is has no offset, therefore its index is zero. For the sake of readability and consistency, I'd highly suggest you to use zero based indices. It's also, as a matter of fact, more logical.


Originally Posted By: Reconnoiter
I am also trying putting in a text array, but I can't seem to get pstring with it working right. Anyone an idea why the beneath str_cpy results in a crash?

Only because you think it's logical to start with index 1, it doesn't mean that the engine does. You create a text with one string, and try to copy values into the second one.

Check your pointers and indices! Especially if you are inexperienced, you really ought to stick with the convention, ie zero based indices, to avoid errors like this. That your program crashes is good, technically it's undefined behaviour to access unallocated memory and the compiler is allowed to destroy your hard drive, destroy the universe or fuck your sister. In many cases though, corrupt pointers will not crash but it seems to just work, but in reality they will alter a memory area of something else, leading to weird behaviour and strange bugs.


Shitlord by trade and passion. Graphics programmer at Laminar Research.
I write blog posts at feresignum.com