473,382 Members | 1,639 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

"initializer element not constant" issue

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
3 2216
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
zoeb
17
Thanks for the help, I copied it into another source file and it compiled no problem! Thanks anyway!
Oct 23 '08 #3
JosAH
11,448 Expert 8TB
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

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

Similar topics

15
by: Barry | last post by:
Hi group, Does anyone know why I get a W3 validator error (click the validation link at the bottom of the page) for http://www.polisource.com/consumer-protection.shtml saying "Line 227, column...
2
by: Todd Nathan | last post by:
Hi. have this code and compiler problem. GCC 2.95.3, BeOS, error "initializer element is not constant" #ifdef FILEIO { static struct { char *sfn; FILE *sfd; } stdfiles = {
9
by: Player | last post by:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hello all. I am in the process of teaching myself C# and I think I am doing OK. I have learnt how to how to call the right constructor of a...
1
by: emin.martinian | last post by:
When trying to compile python extensions written in C using "python setup.py build" on cygwin I get the following error: foo.c: initializer element is not constant foo.c: error: (near...
1
by: tankbattle | last post by:
That is, what's the difference between <complexType name="Address" final="restriction"> <sequence> <element name="name" type="string"/> <element name="street" type="string"/> <element...
1
by: pirunnyrkki | last post by:
Being utterly useless when it comes to JavaScript, I come here for help with an issue that may or may not be an actual problem. Say for example that I have a link that looks like thus: <a...
4
by: jaime | last post by:
Hi again all. Given the line: const int x=5; Can I then use "x" as a constant expression? (By "constant expression", I mean "constant expression" as defined in the C99 standard) I've been...
2
by: hankypan1 | last post by:
Hi All, I need a tree data structure for my application. It is the non - cyclic simple tree where i can have any number of children node and each child can recursively become a sub tree like a...
13
by: bobg.hahc | last post by:
running access 2k; And before anything else is said - "Yes, Virginia, I know you can NOT use a variable to set a constant (that's why it's constant)". BUT - my problem is - I want a constant,...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.