Can someone summarize what exactly this perticular code is doing

#include<stdio.h>
#include<string.h>

int main()
{
        char a[10]={0,1,2,3,4,5,6,7,8,9};
printf("\n--%s-- unable to access values",a);
printf("\n--%d %d-- able to access through direct acess",a[2],a[3]);
printf("\n--%d-- but the failing to read the size\n",strlen(a));
return 0;
}

See the 0 (zero) in the char a[] array? When printf tries to to display a string (the %s format) it stops with a byte that is zero - ascii NUL. That is the very first byte in the array. Nothing prints, because %s says stop at NUL. The strlen() function works the same way - it stops with NUL. So "length" is zero.

printf promotes a[2] from a char to an int, then prints it -- the %d version of printf.
When you deal with a single signed char (one byte) C has standards. One of those standards or rules discusses promoting values. A signed char datatype when used in a context which deals with aritmetic (number) operations gets placed into a register just like as if it were an int datatype. So the %d format specifier on a char produces a number on the tty.

good observation ,,,,,,,,:):)thanks for your reply.