By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,002 Members | 2,137 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,002 IT Pros & Developers. It's quick & easy.

"initializer element not constant" issue

P: 17
Hi,

I am declaring an array which carries x coordinates, however these will vary depending on the geometry the user enters.

I have set my code up as follows, but get the "initializer element not constant" issue. I had the code compiling earlier, but made the mistake of moving thing aorund without taking a backup and now nothing works!

Any help would be greatly appreciated.

/*================================================= ======*/
#include <stdio.h>
#include <stdlib.h>
#include <grx20.h>

/*Declare types of parameters entered */
float x1, x2, x3, yone, y2, y3;
float x23;
int NoMembers, NoNodes;


main()

{

x1 = 4;
x2 = 2;
x3 = 6;
yone = 4;
y2 = 10;
y3 = 14;


x23 = 6;

}

float x1co[] = {-x1, x1, x1, -x23, -x23, x23, x23, -x2, x2, x2, -x3, -x2, x2, x3};

/*================================================= =*/
Oct 23 '08 #1
Share this Question
Share on Google+
3 Replies


P: 79
Well everything I'm seeing here should work fine, so the problem's most likely in a part of your program that is not posted here.
Oct 23 '08 #2

P: 17
Thanks for the help, I copied it into another source file and it compiled no problem! Thanks anyway!
Oct 23 '08 #3

Expert 10K+
P: 11,448
Thanks for the help, I copied it into another source file and it compiled no problem! Thanks anyway!
That wasn't the problem: the first time you tried to compile it as if it were a C file;
the last time you used a C++ compiler.

kind regards,

Jos
Oct 23 '08 #4

Post your reply

Sign in to post your reply or Sign up for a free account.