This code returns n=11, with 10th and 11th character as ' ' and '@' How does this work? How does strlen function take it as 11 characters? It seems like it takes the string length as 12 characters in some compilers.
#include <stdio.h>
#include <string.h>
void fun(char *arr)
{
int i;
unsigned int n = strlen(arr);
printf("n = %d\n", n);
for (i=0; i<n; i++)
printf("%c ", arr[i]);
}
int main()
{
char arr[] = {'g', 'e', 'e', 'k', 's', 'q', 'u', 'i', 'z'};
fun(arr);
return 0;
}