"The function returns the character written as an unsigned char cast to an int or EOF on error": see Putchar. In order to do practice, I produced this program:
#include<stdio.h>
int main(void){
for(putchar('1'); putchar('2'); putchar('3'))
putchar('4');
return 0;
}
It results in an infinite loop whit output ...432432432432432...
.
I cannot get the reason behind such a result. I expected the loop to print just the same number over and over. I am referring to the value of putchar('4'), where the character '4' should be promoted to the int 52. Why such promotion is not behaving as I expected?