由预处理器管理的数组 [英] Array managed by preprocessor

查看:50
本文介绍了由预处理器管理的数组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的老师说C中的数组是由预处理器管理的。


Preprocesser用

替换所有数组出现(即int [10])我不理解/记得很清楚。


预处理/编译阶段阵列究竟发生了什么?


谢谢提前

解决方案

/ * frank * /写道:

我的老师说C中的数组是由预处理器管理的。

Preprocesser用一些我不理解/记得不错的东西替换所有阵列出现(即int [10])。

什么是在预处理/编译阶段确实发生了数组吗?

提前致谢




嗯,这里有两种可能:


1)你误解了老师说的话。

2)你的老师非常可怕,非常错误。


我怀疑你需要修改坐在主题上;为什么不*问你的老师*?


HTH,

-ag


-

Artie Gold - 德克萨斯州奥斯汀


他们指责你 - 是他们的计划。

< br>

Artie Gold ha scritto:

1)你误解了老师说的话。




如果我有这个数组:


a [i]


预处理器将其翻译成*(a + i)

a被翻译为costant。

谢谢


/ * frank * /< __ ******* @ despammed.com>潦草地写道:

Artie Gold ha scritto:

1)你误解了老师说的话。


如果我有这个数组:
a [i]
预处理器将其翻译成*(a + i)
a翻译为costant。




预处理器没有'不能把它翻译成任何东西。它的工作在

那个阶段完成,它已退出舞台。 []是一个成熟的运算符在
C中。它的行为定义为*(间接)和+(加法)

运算符组合使得a [i]表示*(a + i)。另外,我[a]的意思是[i]相同的




-

/ - Joona Palaste(pa*****@cc.helsinki.fi)-------------芬兰-------- \

\- - http://www.helsinki.fi/~palaste ---- -----------------规则! -------- /

自行车不能自行站立,因为它是双轮胎。

- Sky Text


My teacher said that array in C is managed by preprocessor.

Preprocesser replace all array occurences (i.e. int a[10] ) with
something that I don''t understand/remember well.

What''s exactly happens with array during preprocessing/compiling stage?

Thanks in advance

解决方案

/* frank */ wrote:

My teacher said that array in C is managed by preprocessor.

Preprocesser replace all array occurences (i.e. int a[10] ) with
something that I don''t understand/remember well.

What''s exactly happens with array during preprocessing/compiling stage?

Thanks in advance



Well, there are two possibilities here:

1) You misunderstood what your teacher said.
2) Your teacher is horribly, horribly wrong.

I suspect you need to revisit the subject; why not *ask your teacher*?

HTH,
--ag

--
Artie Gold -- Austin, Texas

"What they accuse you of -- is what they have planned."


Artie Gold ha scritto:

1) You misunderstood what your teacher said.



If I have this array:

a[i]

the preprocessor translate it, into *(a+i)

a is translated as costant.
Thanks


/* frank */ <__*******@despammed.com> scribbled the following:

Artie Gold ha scritto:

1) You misunderstood what your teacher said.

If I have this array: a[i] the preprocessor translate it, into *(a+i) a is translated as costant.



The preprocessor doesn''t translate it into anything. Its job is done at
that stage and it has exited stage left. [] is a full-blown operator in
C. Its behaviour is defined as the * (indirection) and + (addition)
operators combined so that a[i] means *(a+i). Also, i[a] means the same
thing as a[i].

--
/-- Joona Palaste (pa*****@cc.helsinki.fi) ------------- Finland --------\
\-- http://www.helsinki.fi/~palaste --------------------- rules! --------/
"A bicycle cannot stand up by itself because it''s two-tyred."
- Sky Text


这篇关于由预处理器管理的数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆