:: Re: [DNG] Making sense of C pointer…
Top Page
Delete this message
Reply to this message
Author: Edward Bartolo
Date:  
To: dng
Subject: Re: [DNG] Making sense of C pointer syntax.
Hi,

As far as I know, the compiler automatically allocates memory for the
address where a pointer is saved. The unallocated part is the data
attached to a pointer. What happens with a pointer to a pointer like
void**? Does the compiler allocate memory for two addresses with the
first one in the chain pointing to the second one? Does it allocate
memory only for the first address?

What I can say about pointers:

a) int * K ===>    Address(preallocated) -------------------> integer
[ not preallocated ]


b) void** V ===> Address1 (preallocated) ------> Address2(preallocated)

OR:

void** V ===> Address1 (preallocated) -----> Address2(not preallocated)

?

c) int **L ===> Address1 (preallocated) -----> Address2(allocated)
-----> int (not allocated)

OR

int **L ===> Address1(preallocated) -----> Address2(not allocated)
-----> int (not allocated)

By 'preallocated' I mean the compiler will automatically generate code
to allocate memory for the actual pointer not the data.

d) Is this allowed: void***, int***, double***, etc?