I'm trying the following mentioned code in C:
#include <stdio.h>
#include <string.h>
int main()
{
char buff[12];
unsigned int length;
while(1)
{
strcpy(buff,"Message123456789\n\r");
length = strlen(buff);
printf("%s\n",buff);
printf("String length= %d",length);
}
}
The output is:
String length= 18Message123456789
So, I want to ask if the buff array is only 12 character long then how it is accommodating a 18 character string in itself?