why sizeof s1 is h=showing 5byte it should be 5+6=11 na because it s taking helloabcde\0 so it should be 11 ?in output
?
Character array
@guptashubham210a thats because s1 actually stores only 5 characters but when printed it starts from 0 and keep printing until null encountered so all the garbage elements are not actually stored in s1.
it should be -2 na because last char will be \0 and index starts from 0 so n-1 index and -1 for \0? so n-2
@guptashubham210a
suppose a is hello
so strlen(a) is 5
indexing start from 0 so it should be -1 only
what about \0? so it should be 6 na? or it does not count \0?
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.