:: Re: [DNG] Making sense of C pointer…
Forside
Slet denne besked
Besvar denne besked
Skribent: karl
Dato:  
Til: dng
Emne: Re: [DNG] Making sense of C pointer syntax.
Rainer Weikusat:
...
> One thing to note here: Every C pointer is really a pointer to an array
> of values, although the size of the array may just be one.

...

I thought it was the other way around, a pointer is just an address to
some (a single) memory location which can be part of an array, I'd
not consider int ii to be an array even though int *pp = &ii,
-- but who cares.

But there is a real differnce between
int arr[10];
and
int *pp = calloc(10, sizeof(int));
as pp can be assigned to, but not arr, i.e. pp = malloc() works
but not arr = malloc().

Regards,
/Karl Hammar

-----------------------------------------------------------------------
Aspö Data
Lilla Aspö 148
S-742 94 Östhammar
Sweden
+46 173 140 57