Q1:
if (...)
{
byte[] var1 = new byte[4];
var1[0] = 'A';
var1[1] = "B';
var1[2] = 'C';
var1[3] = 'D';
CheckInput(var1); // CheckInput(bytes[] bytes)
...
}
When defining a variable like "var1" in the above code to hold a string of
"ABCD", should it be declared as:
byte[] var1 = new byte[5];
with the last byte to be assigned to '\0' like in C, since var1 will be put
in "CheckInput(bytes[] bytes)" call?
Q2:
if (...)
{
byte[] var1 = new byte[4];
var1[0] = 'A';
var1[1] = "B';
var1[2] = 'C';
var1[3] = 'D';
CheckInput(var1);
...
}
if (...)
{
byte[] var1 = new byte[10];
...
}
Will it be Okay to reuse the var1 this way? Or is there a better to release
var1 for reusing it in the following code?