char age[2];
is way too small. If you input exactly 2 characters, scanf
will write the termination string into lname[0]
because in this specific case the memory between both arrays is contiguous.
Thus printf
will see an empty array and the result will be the one you observe