#include <stdio.h>
char s[3] = "Robert";
int main()
{
printf("%s",s);
}
Output: Rob
How does this get printed properly? The string is not null terminated. I saw the assembly. It used .ascii for storing "Rob" which is not null terminated. I expected some garbage along with Rob to be printed. Can someone explain me this behaviour?