C++ find size of the short* array

73 Views Asked by At

Not very familiar with C++, and have perhaps some very fundamental question:

i have a struct:

struct ADDING_BYVAL
{
    #define THIRDNUMBER 100;

    short _firstNBuff[4];
    long _secondNVal;
    short* _thirdNBuff;
    char* _pretext;
}; 

I am initializing this struct as so:

short thirdBuff[] = {6, 7};
char pret1[] = { "pretextVal" };
struct ADDING_BYVAL adding_byval = { 
    { 1,2,3,4 }, 
    5, 
    thirdBuff,
    pret1
}; 

now I want to find the length of the array adding_byval._thirdNBuff using sizeof() gives me size of the pointer rather than size of the array it points to. How do i do that?

0

There are 0 best solutions below