How s1[]={'h,'e','l','l','o'} is printing helloabcde 5

s1[]={'h,‘e’,‘l’,‘l’,‘o’} is printing helloabcde 5.
sir said that it will store garbage but why we did not mention the size so it should take size as 5 by itself and let somehow it is taking garbage then size should be 10
pls resolve both doubts?

hello @kkunalguptaaa
sizeof will always work fine in any cases (because array memory is equal to memory occupied by its content ,during declaration we mention fixed number of content so size will fixed) .

the issue happens when print any char * / char array , compiler look for \0 to stop (ie \0 is delimeter for compiler) so if we dont mention it compiler will print string along with some garbage.