my question is I have created a char array of size 4.if i assigned values as below in the code without specifying the null character.How does it prints garbage values after the first four elements when the size of the char array is 4.
#include<stdio.h>
int main(){
char array[4];
array[0] = 'J';
array[1] = 'O';
array[2] = 'h';
array[3] = 'n';
printf("%s\n",array);
return 0;
}