#include<stdio.h>
void main()
{
char str[4] ="HELLO";
printf("%s",str);
}
What actually is happening here ??
The output is : HELL?
#include<stdio.h>
void main()
{
char str[4] ="HELLO";
printf("%s",str);
}
What actually is happening here ??
The output is : HELL?
You can´t assign 5 values to a 4 size array, when you put Hello
it is interpreted as {'h', 'e', 'l', 'l', 'o'}
, so you need at least 5 size array.
Taking into account that C needs also a last character '/0', i recommend you to put it as 6 size array