Some questions on statements

  1. What is the behaviour of the following programme?
    #include<stdio.h>
    #include<stdlib.h>
    int main()
    {
          int j, k;
          j = 0;
          k = 2;
          while (j=k)
          {
             j++;
             printf("%d\n",j);
          }
          return EXIT_SUCCESS;
    }
    
    Plain text version to try out

Answers to these questions


Back to the notes on statements