variable initialization / I'm a n00b



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

.



Relevant Pages

  • Re: variable initialization / Im a n00b
    ... double foo = cosh; ... int main{ ... initializer element is not constant ...
    (comp.lang.c)
  • Re: variable initialization / Im a n00b
    ... int main{ ... initializer element is not constant ... Ritchie is the inventor of C and this is the definitive book on the language. ...
    (comp.lang.c)
  • Re: [C] strcat() question (ongoing)
    ... > At the machine level, yes, basically (depending on your definition ... We can only "PUT" data in / or assign data to variables such as an int or ... foo is an object? ... > house and look on the microwave. ...
    (alt.comp.lang.learn.c-cpp)
  • PCI Device Driver
    ... saa713x.c:161: error: initializer element is not constant ... saa713x_open(dev_t dev, int oflags, int devtype, d_thread_t *td) ...
    (freebsd-hackers)
  • Re: call of variadic function
    ... arguments that should be passed to this function are of type int. ... You call foo with more arguments than are ... which is the standard way to access arguments of a variadic function ... Here the else clause of my sentence specifies one of the numerous non- ...
    (comp.lang.c)