-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Scott said:
Charles said:
Hi,
I have this code,
unsigned int input_0[8];
*input_0++ = 100;
*input_0++ = 200;
*input_0++ = 300;
*input_0++ = 400;
*input_0++ = 1;
*input_0++ = 2;
*input_0++ = 3;
*input_0 = 4;
The compiler is gcc ported to a specific embedded processor. The
compiler complains that I can not use increment operation like that.
Do you know why?
Your variable "input_0" is an array name, and thus a constant.
It can *not* be incremented. Try this:
unsigned int *uiray[8];
unsigned int *input_0 = uiray;
*input_0++ = 100;
*input_0++ = 200;
*input_0++ = 300;
*input_0++ = 400;
*input_0++ = 1;
*input_0++ = 2;
*input_0++ = 3;
*input_0 = 4;
In this code, "input_0" is a pointer, *not* an array name.
why not just do:
int a = 0;
unsigned int input_0[8];
input_0[a++] = 100;
input_0[a++] = 200;
input_0[a++] = 300;
input_0[a++] = 400;
input_0[a++] = 1;
input_0[a++] = 2;
input_0[a++] = 3;
input_0[a] = 4;
or hell, just:
unsigned int input_0[8];
input_0[0] = 100;
etc.
or even
int a = 7;
unsigned int input_0[8] = { 100, 200, 300, 400, 1, 2, 3, 4};
which would produce the same end state
- --
Lew Pitcher, IT Specialist, Corporate Technology Solutions,
Enterprise Technology Solutions, TD Bank Financial Group
(Opinions expressed here are my own, not my employer's)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (MingW32)
Comment: Using GnuPG with Mozilla -
http://enigmail.mozdev.org
iD8DBQFEkEM8agVFX4UWr64RAjalAJ9T8HTTtL/H7c5icZ0EU1OKsCKhlwCfZ7yy
0aGWb5Q7RDlJYOg6b27mTew=
=LsN2
-----END PGP SIGNATURE-----