爲什麼星號在變量名之前,而不是類型之後? - Why is the asterisk before the variable name, rather than after the type?

問題:

Why do most C programmers name variables like this:爲什麼大多數 C 程序員這樣命名變量:

int *myVariable;

rather than like this:而不是這樣:

int* myVariable;

Both are valid.兩者都有效。 It seems to me that the asterisk is a part of the type, not a part of the variable name.在我看來,星號是類型的一部分,而不是變量名稱的一部分。 Can anyone explain this logic?誰能解釋一下這個邏輯?


解決方案:

參考一: https://en.stackoom.com/question/1fdj
參考二: https://stackoom.com/question/1fdj
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章