How to correct Warning : array subscript has type 'char' [-Wchar-subscripts]
The warning is fairly self explanatory. One of your array subscripts is a char.

Specifically:

for (char i=0 ...
     PacketData[i] = ...


Notice how i, your array subscript (index), is a char type.

The reason this is bad is that chars are often unexpectedly signed which means you can end up with negative subscripts if you don't realise that - i.e. if you didn't realise it was signed, instead of accessing index [128], you would be inadvertently accessing index [-128].

You should be able to fix the warning by simply replacing char i with unsigned char i if working on an 8-bit processor. For a 32bit processor, you are better off using an unsigned int as it will be much more efficient.

Alternatively, given your code doesn't ever set i to be negative, simply ignore the warning. However make sure you check your for loop conditions. Arrays are 0-indexed, meaning an array declared with a size of [50] has elements numbered 0 through to 49. Your for loop does i &lt;= 50 which means it will try to access a non-existent element index 50. You should change that to i &lt; 50.



As a sidenote, why reinvent the wheel:

memset(PacketData, '\0', sizeof(PacketData)/sizeof(PacketData[0]))