**双重奇怪的行为 [英] strange behavior with **double
问题描述
我有一个双**(双**系数)。
和gcc接受语法coef [i] [j],它有效。
我不喜欢不明白为什么。对我来说,coef [i] [j]是不正确的,因为它是* b $ ba ba **而不是[] []。
如果有人能解释我的话。
I got a double ** (double **coef).
And gcc accept the syntax coef[i][j], it works.
I don''t understand why. For me coef[i][j] is not correct because it''s
a double ** and not type[][].
If someone could explain me that.
推荐答案
2007年9月27日星期四03:50:27 -0700,即*** @ free.fr 写道:
On Thu, 27 Sep 2007 03:50:27 -0700, ie***@free.fr wrote:
我得到了双**(双**系数)。
和gcc接受语法coef [i] [j],它有效。
我不明白为什么。对我来说,coef [i] [j]是不正确的,因为它是* b $ ba ba **而不是[] []。
如果有人能解释我的话。
I got a double ** (double **coef).
And gcc accept the syntax coef[i][j], it works.
I don''t understand why. For me coef[i][j] is not correct because it''s
a double ** and not type[][].
If someone could explain me that.
我不明白,你在哪里使用这种语法?请复制和
粘贴代码。 (这很可能是正确的。)
-
Army1987(将NOSPAM替换为电子邮件)
汉堡包总比没有好。
没有比永恒的幸福更好的了。
因此,汉堡包比永恒的幸福更好。
I don''t understand, where do you use that syntax? Please copy and
paste the code. (It is well possible that it is correct.)
--
Army1987 (Replace "NOSPAM" with "email")
A hamburger is better than nothing.
Nothing is better than eternal happiness.
Therefore, a hamburger is better than eternal happiness.
我得到了这个结构:
struct matrix
{
int c,r;
double ** coef;
};
和此功能可以访问它:
double matrix_get(MATRIX * m,int i,int j)
{
return m-> coef [i] [j] ;
}
它有效。但对我来说这太棒了。
I got this structure:
struct matrix
{
int c, r;
double **coef;
};
and this function to access it:
double matrix_get (MATRIX *m, int i, int j)
{
return m->coef[i][j];
}
It works. But for me it''s amazing.
文章< 11 ***************** *****@n39g2000hsh.googlegroups .com> ;,
ie***@free.fr < ie * **@free.frwrote:
In article <11**********************@n39g2000hsh.googlegroups .com>,
ie***@free.fr <ie***@free.frwrote:
>我得到了这样的结构:
struct matrix
$
int c,r;
double ** coef;
};
这个函数可以访问它:
double matrix_get(MATRIX * m,int i,int j)
{
return m-> coef [i] [j];
}
>I got this structure:
struct matrix
{
int c, r;
double **coef;
};
and this function to access it:
double matrix_get (MATRIX *m, int i, int j)
{
return m->coef[i][j];
}
It works. But for me it''s amazing.
我认为你真的需要学习C语言的基础知识。通过将数组转换为指针来实现
in C的工作原理它的第一个元素)
然后添加下标和解除引用。所以下标是
真的是一个指针操作,而不是数组操作。
我可以更详细地描述它,但这就是书的用途。
- Richard
-
应考虑到需要多少人一些字母表中包含32个字符
" - 1963年的X3.4。
I think you really need to learn the basics of C. Array subscripting
in C works by converting the array to a pointer (to its first element)
and then adding the subscript and dereferencing. So subscripting is
really a pointer operation, not an array operation.
I could describe it in more detail, but that''s what books are for.
-- Richard
--
"Consideration shall be given to the need for as many as 32 characters
in some alphabets" - X3.4, 1963.
这篇关于**双重奇怪的行为的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!