News for hackers. Stuff that matters.
Re:Everything I wish I knew when learning C by fsociety on Monday November 28, 2022 @05:43PM (#33780954)
Essentially ‘b = a’ in the second example is equivalent to ‘b = &a[0]’ or assigning an array to a pointer.

This is because if you use an array in an expression, it’s value is (most of the time) a pointer to the array’s first element. But the left element is not an expression, therefore it is referring to b the array.

Example one works because no arrays are referred to in the expression side, so this shorthand so to speak is avoided.

Arrays can be a painful edge in C, for example variable length arrays are hair pulling.

Re:Everything I wish I knew when learning C by int_19h on Friday December 02, 2022 @02:17PM (#33835365)
The left side of assignment in C is an expression. it's just not in a context where array-to-pointer decay is triggered.