Best practice to declare character array in C -
i have read data device 4 bytes long have declared array like
char data[4] = {0}; i parse per index , guarantee stop @ index 3.
data[0]..data[3]
in case there no room nul('\0').
i want know considered safe or should declare array as
char data[5] = {0}; this array not used in str* series of functions.
if data read string of 4 bytes or if greater 4 bytes , using char character array instead of string no need worry. otherwise have care '\0'.
Comments
Post a Comment