Groups | Search | Server Info | Login | Register
Groups > comp.programming > #3828
| From | Todd Carnes <toddcarnes@gmail.com> |
|---|---|
| Newsgroups | comp.programming |
| Subject | Initializing Multi-dimensional Arrays in C |
| Date | 2011-02-03 11:05 -0500 |
| Organization | Aioe.org NNTP Server |
| Message-ID | <iiejo7$lsk$1@speranza.aioe.org> (permalink) |
Hello everyone! :)
I have some code. The code compiles and everything works as it should.
However, when I compile it, I get the same error... 26 times.
Now, I know I should probably just ignore those errors and get on with
my coding, but it's not in my nature to do so. It seems to me that, if
there's a warning, it's there for a reason and should be taken care of.
Thus my question...
Example of code in question:
double ag[3][3] =
{-0.0548755604, +0.4941094279, -0.8676661490,
-0.8734370902, -0.4448296300, -0.1980763734,
-0.4838350155, +0.7469822445, +0.4559837762};
Warning I am getting:
warning: missing braces around initializer (near initialization for ag[0])
Question: Will the following eliminate the warnings without breaking the
code?
double ag[3][3] =
{{-0.0548755604, +0.4941094279, -0.8676661490},
{-0.8734370902, -0.4448296300, -0.1980763734},
{-0.4838350155, +0.7469822445, +0.4559837762}};
My problem is that I'm not sure how (in what order) the values are being
assigned in the first example. so, I'm not sure if my 'fix" will change
the order of assignment.
Thanks,
Todd
P.S. I don't think it should matters, but just in case, I'm compiling on
linux.
Back to comp.programming | Previous | Next — Next in thread | Find similar
Initializing Multi-dimensional Arrays in C Todd Carnes <toddcarnes@gmail.com> - 2011-02-03 11:05 -0500
Re: Initializing Multi-dimensional Arrays in C Todd Carnes <toddcarnes@gmail.com> - 2011-02-03 14:29 -0500
Re: Initializing Multi-dimensional Arrays in C "Pascal J. Bourguignon" <pjb@informatimago.com> - 2011-02-03 23:02 +0100
Re: Initializing Multi-dimensional Arrays in C Todd Carnes <toddcarnes@gmail.com> - 2011-02-03 14:25 -0500
Re: Initializing Multi-dimensional Arrays in C James Waldby <not@valid.invalid> - 2011-02-03 17:41 +0000
Re: Initializing Multi-dimensional Arrays in C "Pascal J. Bourguignon" <pjb@informatimago.com> - 2011-02-03 17:26 +0100
csiph-web