What's the rationale for preventing assignment to arrays?

后端 未结 6 432
抹茶落季
抹茶落季 2020-12-18 17:57

I\'ve tried to google this and have read:

  • Why can\'t arrays of same type and size be assigned?
  • Assigning arrays
  • Assign to array in struct in
6条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-18 18:43

    Maybe it would be helpful to turn the question around, and ask why you'd ever want to assign arrays (or structs), instead of using pointers? That's much cleaner & easier to understand (at least if you've assimilated the Zen of C), and it has the benefit of not concealing the fact that a lot of work is hidden under the "simple" assignment of multi-megabyte arrays.

提交回复
热议问题