#include int main() { char s[2]=\"a\"; s[1]=\'b\';s[2]=\'c\';s[3]=\'d\';s[5]=\'e\'; printf(\"%s $%c$\",s,s[4]); return 0; }
You are writing/reading outside of the bounds of the array, this is simply undefined behavior you can not make any predictions about what the program will do.