Can someone please explain me why its not possible to put a '\0' character in the given array:
char a[]={'r','b'};
a[2]='\0';
Shouldn't the above code put a null character at the third slot and hence convert the character array a to a character string.
char a[3]={'r','b'};and you have enough defined memory to put on a[2].