Cover image for Predict the Output

Predict the Output

delta456 profile image Swastik Baranwal ・1 min read

Predict the output of the following code and tell me why this works:

#include <stdio.h>
int main()
    int x = 10;
    while (x --> 0) 
        printf("%d ", x);
   return 0;

The one who answers well will get a follow back!


markdown guide

Yeah correct but --> works because the lexer ignores whitespace and x-- is parsed.


Great! Can you also tell why --> works?