I' studying for my test and I came across with a decent code with weird results. I understand the result of the first two lines in main(), however I don't understand why my computer prints the answer like the picture!!
#include <stdio.h>
void printstring(char s[]) {
int i;
for (i = 0; i < 10; i++)
printf(" s[%d]", i);
printf("\n");
for (i = 0; i < 10; i++)
printf("%5c", s[i]);
printf("\n");
for (i = 0; i < 10; i++)
printf("%5X", s[i]);
printf("\n");
printf("\n");
}
main() {
printstring("I am beautiful");
printstring("beautiful");
printstring("");
}