How to check if array[0] doesn't exist?
newb question:
In pascal (gpc), how do I check if a position in a certain array is not occupied? (for char arrays and real arrays) Will it contain 0? Can I use the null or void keywords with gpc? (I'm not familiar with pascal..) -thanks |
Well, an array, all "positions" are always occupied - if you have an array of integeres, there's no way for any position to not be occupied. It's value might not be initialized though.
If it's an array of pointers, you can use the special value nil (similar to C's NULL) to mean that it doesn't point to anything. Hope this helps, Guttorm |
Initialize all elements of your array to a special value that indicates that a position is not occupied (maybe -1 or 0 or something).
So that you can check against that value to see if an element is empty or not. |
thanks :)
|
All times are GMT -5. The time now is 11:56 PM. |