signed char ch=5;
while(ch = ch--)
    printf("%d",ch);
I read this. It is clearly stated that while statement and end of a statement(;) are sequence points.
So i don't understand why the above one runs infinite time and prints same value[5].
signed char ch=5;
while(ch = ch--)
    printf("%d",ch);
I read this. It is clearly stated that while statement and end of a statement(;) are sequence points.
So i don't understand why the above one runs infinite time and prints same value[5].
 
    
    Your code should be
signed char ch=5;
while(ch--)
    printf("%d",ch);
as ch-- already is an assignment. You reassigned ch to its previous value before ch-- with ch = ch-- so ch-- has no effect and you get the same value at each iteration.
 
    
    This should work for you:
#include <stdio.h>
int main() {
    signed char ch=5;
    while(ch--)
        printf("%d\n",ch);
    return 0;
}
