Usage of length method instead of sizeof for correct value