变量初始化/我是一个n00b [英] variable initialization / I'm a n00b

查看:52
本文介绍了变量初始化/我是一个n00b的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好 - 这是我在这里的第一篇文章 - 只是一个简单的问题:


#include< math.h>

double foo = cosh (0.621);

int main(){

返回0;

}


失败与


错误:初始化元素不是常数


除了告诉我我做错了什么之外,请你参考

我对相关问题的适当参考?我一直在做

我的阅读(开网+野生动物园书架),但我不知道在哪里看b $ b。即使我必须(感叹)买书,我也会感激你的

指针。


谢谢和问候,

罗斯

Hi all- this is my first post here- just a quick question:

#include <math.h>
double foo = cosh(0.621);
int main() {
return 0;
}

fails with

error: initializer element is not constant

In addition to telling me what I''m doing wrong, could you please refer
me to an appropriate reference for related questions? I''ve been doing
my reading (open net + safari bookshelf), but I don''t know where to
look. Even if I have to (sigh) buy a book, I would appreciate your
pointers.

Thanks and regards,
Ross

推荐答案

" rjtucke" < rj ***** @ gmail.comwrote:
"rjtucke" <rj*****@gmail.comwrote:

大家好 - 这是我在这里的第一篇文章 - 只是一个简单的问题:


#include< math.h>

double foo = cosh(0.621);

int main(){

返回0;

}


失败


错误:初始化元素不是常数
Hi all- this is my first post here- just a quick question:

#include <math.h>
double foo = cosh(0.621);
int main() {
return 0;
}

fails with

error: initializer element is not constant



是吗?静态持续时间对象的初始化程序(即全局对象,

和您使用静态声明的本地对象)必须是编译时

常量,函数调用不是编译时常量,即使

所有参数都是。

Yes? Initialisers for static-duration objects (i.e., "global" objects,
and "local" objects you''ve declared using static) must be compile-time
constants, and a function call is not a compile-time constant, even if
all its arguments are.


除了告诉我我做错了什么,请你参考

我对相关问题的适当参考?
In addition to telling me what I''m doing wrong, could you please refer
me to an appropriate reference for related questions?



K& R。


Richard

K&R.

Richard


rjtucke写道:
rjtucke wrote:

大家好 - 这是我在这里的第一篇文章 - 只是一个简单的问题:


#include< math。 h>

double foo = cosh(0.621);

int main(){

返回0;

}


失败了


错误:初始化元素不是常数


除了告诉我,我做错了什么,请你参考

我的相关问题的适当参考?我一直在做

我的阅读(开网+野生动物园书架),但我不知道在哪里看b $ b。即使我必须(感叹)买书,我也会感激你的

指针。


谢谢和问候,

Ross
Hi all- this is my first post here- just a quick question:

#include <math.h>
double foo = cosh(0.621);
int main() {
return 0;
}

fails with

error: initializer element is not constant

In addition to telling me what I''m doing wrong, could you please refer
me to an appropriate reference for related questions? I''ve been doing
my reading (open net + safari bookshelf), but I don''t know where to
look. Even if I have to (sigh) buy a book, I would appreciate your
pointers.

Thanks and regards,
Ross



" K& R"是C编程语言。作者:Brian Kernighan&丹尼斯

里奇。 Ritchie是C的发明者,这是关于该语言的最终

书。如果你已经熟悉了一般的编程,那么它就是开始学习C的好地方。如果不是b $ b,那么有些书更适合初学者。


在线(在许多其他好网站中)看到:
http://c-faq.com/
http: //clc-wiki.net/wiki/


John Smith在01/31/07 13:42写道:
John Smith wrote On 01/31/07 13:42,:

rjtucke写道:
rjtucke wrote:

>>大家好 - 这是我在这里的第一篇文章 - 只是一个简单的问题:

#include< math.h>
double foo = cosh(0.621);
int main(){
返回0;
}

失败了

错误:初始化元素不稳定

除了告诉我我做错了什么,请你参考
我为相关的que提供了适当的参考stions?我一直在做我的阅读(开网+野生动物园书架),但我不知道在哪里看。即使我不得不(叹气)买书,我也很感激你的指示。

感谢和问候,
Ross
>>Hi all- this is my first post here- just a quick question:

#include <math.h>
double foo = cosh(0.621);
int main() {
return 0;
}

fails with

error: initializer element is not constant

In addition to telling me what I''m doing wrong, could you please refer
me to an appropriate reference for related questions? I''ve been doing
my reading (open net + safari bookshelf), but I don''t know where to
look. Even if I have to (sigh) buy a book, I would appreciate your
pointers.

Thanks and regards,
Ross



" K& R"是C编程语言。作者:Brian Kernighan&丹尼斯

里奇。 Ritchie是C的发明者,这是明确的



"K&R" is "The C Programming Language" by Brian Kernighan & Dennis
Ritchie. Ritchie is the inventor of C and this is the definitive



s /这是/这是/

s/this is/this was/


关于语言的书。如果您已经熟悉一般的编程,那么这是一个开始学习C的好地方。如果不是b $ b,那么有些书更适合初学者。
book on the language. If you are already familiar with
programming in general, it''s a good place to start learning C. If
not, there are books better oriented to beginners.



K& R在半年前不再是C上的权威工作,大约十七美元。尽管如此,阅读比最近的权威作品更好。


-
Er ********* @ sun.com


这篇关于变量初始化/我是一个n00b的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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