Re:C Strings and my slow descent to madness
by int_19h on Thursday April 06, 2023 @03:52PM
(#35473497)
This also makes a big difference once we start talking about pointers to arrays.
int a[] = {1, 2, 3}
int (*p)[3] = &a; // ok
int *q = a; // not ok
Re:C Strings and my slow descent to madness
by strkitten on Thursday April 06, 2023 @05:03PM
(#35474405)
Nothing wrong with your third line. Did you mean something else?
In some contexts, the name of an array decays to a pointer to its first element. That is a better way of putting it, and it's a (much) weaker statement.
Edit: if they were the same, this code:
Would print the same valde twice, but it doesn't. On Ideone [1] I got 12 and 8.[1]: https://ideone.com/CP7WTu