News for hackers. Stuff that matters.
Re:Everything I wish I knew when learning C by int_19h on Friday December 02, 2022 @02:31PM (#33835592)
For this example:

   char str[256]; str = "asdf"
both str and "asdf" are not pointer-type expressions; they're both arrays (which is exposed by sizeof). The reason why this doesn't work is because C refuses to treat arrays as first-class value types - which is not an obvious thing to do regardless of how well you understand pointers or not. Other languages with arrays and pointers generally haven't made this mistake.

There are no comments on this comment yet.