Semantics of char a[]

后端 未结 6 622
忘掉有多难
忘掉有多难 2021-02-01 23:34

I recently embarrassed myself while explaining to a colleague why

char a[100];
scanf(\"%s\", &a); // notice a & in front of \'a\'

is ve

6条回答
  •  感情败类
    2021-02-02 00:10

    Sorry, a tiny bit off topic:

    This reminded me of an article I read about 8 years ago when I was coding C full time. I can't find the article but I think it was titled "arrays are not pointers" or something like that. Anyway, I did come across this C arrays and pointers FAQ which is interesting reading.

提交回复
热议问题