Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pointer Value Error

Status
Not open for further replies.

Jodi999

Programmer
Feb 24, 2004
10
US
I have a line of code as follows:

S_ptr = (BYTE*)&ARCFOUR_Sbox[0];

...where S_ptr is a Byte* and ARCFOUR_Sbox is a UINT16.

I get the errors:

C2109: subscript requires array or pointer type
C2102: '&' requires l-value

Can anyone tell me what's wrong with the line of code?
 
> ARCFOUR_Sbox is a UINT16
So it's not an array of UINT16 then?
In which case the [0] on the end is wrong.

If it is a single UINT16
S_ptr = (BYTE*)&ARCFOUR_Sbox[0];

If it is an array, and you want to point to the first element
S_ptr = (BYTE*)ARCFOUR_Sbox;

--
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top