I need to access an array outside of this function:
enter code here
// code in a .cc file
void
ldu1::decode_lcw()
{
uint16_t LCW_BITS[] =
{
410, 411, 412, 413, . . . . . . . . .....
};
uint16_t LCW_BITS_SZ = sizeof(LCW_BITS) / sizeof(LCW_BITS[0]);
uint16_t LCW_BITS = extract(frame_body(), LCW_BITS, LCW_BITS_SZ);
uint16_t encoded_lcw = LCW_BITS;
//call the error correction code from another file, lcw_ecc.h
// decoded_lcw is declared protected in
// the .h file corresponding to this .cc file
lcw_ecc(encoded_lcw, decoded_lcw);
}
the last line there, lcw_ecc() calls this function from an included .h file:
// code in another file, lcw_ecc.h, which holds the
// error correction function definitions
void lcw_ecc(uint16_t encoded_lcw[], uint16_t decoded_lcw[])
{
uint16_t rs_codewords[144] = {0} ;
void decode_hamming( uint16_t encoded_lcw[], uint16_t rs_codewords[] );
void decode_reed_solomon( uint16_t rs_codewords[], uint16_t decoded_lcw[] );
decode_hamming( encoded_lcw, rs_codewords );
decode_reed_solomon( rs_codewords, decoded_lcw );
}
The functions work as singletons in terminal, and this code compiles without error in the lib of the program I am working on. However, I have no confidence that it's done right.
My question is, assuming that the code will modify the 'decoded_lcw' as expected, how can I get access to the modified decoded_lcw array in the rest of the .cc file outside of the first function I put up there, the "ldu1::decode_lcw()" ?? if it is declared private or protected will the other member functions declared there be able to access not for modifying it but solely for inspection? could I pass it in as a parameter?