Q:

how to send a size of array when i allocate a dynamic array C++

I'm trying to send size to a dynamic array, by calling a function, and set the size using the argument SIZE I sent while calling the function.
for example:
That's the function I create my dynamic array in:
JumboPacket(IN OUT UINT8* &p_buffer, ***IN UINT8  size***, IN MACAddress src, IN MACAddress dst)
{
    UINT8 *my_buff_to_send = new UINT8[size] { 0 };
}

Now i call the function with arguments:
JumboPacket( p_buffer, **7000**, MAC_LinkPartner, MAC_DUT);

why do i get a wired number  in IN UINT8  size im expecting in this case to get 7000 
Thanks in advance...

A:

As Vlad from Moscow has commented - you are using a UINT8 variable type as an input.
UINT8 is a declaration for using an 8 bit based, unsigned integer type of variable. This means you can place a value which uses up to 8 bits in order to be represented.
In this case, the maximum value for a UINT8 type variable will be 2^8 - 1, or 255 (and the minimum is, of course 0).
More on this greek bitology can be found here.
Be careful not to overload this variable with more bits then it can store!!

