On Tue, 14 Feb 2006, Florin Iucha wrote:

> On Tue, Feb 14, 2006 at 07:07:04PM -0600, Brian Hurt wrote:
>>> Also when the funcArr1 array is created it is created
>>> as type pt2Function of size 10. But what's going on
>>> with the {NULL} assignment? I'm pretty sure this is
>>> some sort of initialization, but a quick glance says
>>> it's initializing the 10th member of the array to NULL
>>> but not the first 9. I know that's not right, but what
>>> am I missing here?
>>
>> This is bad form in C code.  It'll work, but it's a bad idea.  What he's
>> doing is initializing the *first* element in the array to NULL, and all
>> other elements to 0.  There is no gaurentee that NULL is 0- just that
>> *casting* 0 to a pointer type results in NULL.  This is generally true
>> however.  So the code works, generally.
>
> Only if it is static. Otherwise, items 1 through 9 contain garbage.

Good point.  I habitually initialize all of my variables, so I don't 
bother to remember the tricky aspects of what gets automatically 
initialized to what.

Brian