THis isn't working! Help! =P
all = (words *) malloc(sizeof(words));
I get an error about the )!
and it looks just fine to me
THis isn't working! Help! =P
all = (words *) malloc(sizeof(words));
I get an error about the )!
and it looks just fine to me
Looks ok, but let's see what you have 'all' declared as. Also, you don't have to cast malloc, or any other void* in C.
Code:#include <cmath> #include <complex> bool euler_flip(bool value) { return std::pow ( std::complex<float>(std::exp(1.0)), std::complex<float>(0, 1) * std::complex<float>(std::atan(1.0) *(1 << (value + 2))) ).real() < 0; }
stuct words *ALL[50];
Is how words got defined!
Code:#include <cmath> #include <complex> bool euler_flip(bool value) { return std::pow ( std::complex<float>(std::exp(1.0)), std::complex<float>(0, 1) * std::complex<float>(std::atan(1.0) *(1 << (value + 2))) ).real() < 0; }
Right. Casting the pointer returned from malloc will suppress warning messages that could help to reveal subtle coding errors.Originally posted by Sebastiani
Looks ok, but let's see what you have 'all' declared as. Also, you don't have to cast malloc, or any other void* in C.
I am always amazed at how many "experienced" programmers don't know this, and I'm always pleased when I find one who does.
>stuct words *ALL[50];
>all = (words *) malloc(sizeof(words));
In C, the keyword struct would need to precede words. C is case sensitive, so ALL and all are different things.
Casting malloc
It might be beneficial to use the last form.
7. It is easier to write an incorrect program than understand a correct one.
40. There are two ways to write error-free programs; only the third one works.*