I looked over but couldn’t find a decent answer.
I was wondering how printf works in case like this:
char arr[2] = {5,6};
printf ("%d%d",arr[0],arr[1]);
I was thinking that printf just walks through the format and when it encouter %d for example it reads 4 bytes from the it’s current position… however that’s gotta be misconcepition cause that above works perfectly.
so, where am I wrong ?
You’re right. But there’s argument promotion that converts (among other things) your
char:s intoint:s when they are used with a “varargs” function likeprintf().