TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Everything you need to know about pointers in C

36 点作者 mepcotterell超过 8 年前

2 条评论

mannykannot超过 8 年前
Maybe it is just me, but the author seems to be making things unnecessarily difficult, or even contradictory, in his definitions. Early on, we see &#x27;the pointer is not the variable! The pointer to foo is the contents of foo_ptr.&#x27; Then we see &#x27;The pointer has a type, too, by the way. Its type is int.&#x27; As it has been established that the content of foo_ptr is the address of foo, l do not see any way for these two statements to be consistent.<p>Later, when he writes &#x27;how do we assign an int to this pointer?&#x27;, he seems to be discussing assigning an int to &#x27;the contents of foo_ptr&#x27;, given his earlier definition. I know what he means, of course, but this seems to perpetuate confusion between pointers and the thing pointed to. In my experience, common (if not standard) usage is that pointers are variables whose values are addresses, and one uses &#x27;address&#x27; when talking about addresses and &#x27;pointer&#x27; when referring to a variable containing an address, and it is all pretty clear.
MaulingMonkey超过 8 年前
Not one warning about undefined behavior? Not quite <i>every</i>thing...