S
Susan Rice
I want to create a readonly array of data, then a readonly array of a
structure. This is data I access but I want it protected against
accidental change. The following is my test code.
#include "stdafx.h"
struct LVC
{
unsigned short int lo;
unsigned short int hi;
};
void main()
{
//This seems to work
static const unsigned short int LV[4] =
{0xAC00,
0xAC1C,
0xAC38,
0xAC54 };
//THIS DOESN'T WORK. COMPILER COMPLAINS
static const struct LVC[4] = {
{ 0xAC01, 0xAC1B },
{ 0xAC1D, 0xAC37 },
{ 0xAC39, 0xAC53 },
{ 0xAC55, 0xAC6F },
};
unsigned short i,j;
i = LVC[2].lo;
j = LVC[2].hi;
}
I'm using Microsoft Visual C++ Express Edition
(I'd also like to get rid of that #include "stdafx.h" if
there's some compiler configuration that will allow me
to do that.)
structure. This is data I access but I want it protected against
accidental change. The following is my test code.
#include "stdafx.h"
struct LVC
{
unsigned short int lo;
unsigned short int hi;
};
void main()
{
//This seems to work
static const unsigned short int LV[4] =
{0xAC00,
0xAC1C,
0xAC38,
0xAC54 };
//THIS DOESN'T WORK. COMPILER COMPLAINS
static const struct LVC[4] = {
{ 0xAC01, 0xAC1B },
{ 0xAC1D, 0xAC37 },
{ 0xAC39, 0xAC53 },
{ 0xAC55, 0xAC6F },
};
unsigned short i,j;
i = LVC[2].lo;
j = LVC[2].hi;
}
I'm using Microsoft Visual C++ Express Edition
(I'd also like to get rid of that #include "stdafx.h" if
there's some compiler configuration that will allow me
to do that.)