Doubt
closed

• closed by
411 views
0 0 votes
closed with the note: undefined behaviour in C
#include <stdio.h>
int main()
{
    int i = 0;
    do
    {
        printf("Hello ");
        i = i++;
    }
    while (i < 5);
    return 0;
}
why this prints Hello infinitely?

shouldn't it print Hello 5 times?
Position:
Show:

Related questions

2 2 votes
1 1 answer
1.5k
1.5k views
Sahil1994 asked Dec 11, 2017
1,518 views
What will be the output of following program:-Size of int is 4 bytes#incude<stdio.h>int main(){ int a; for(a=1;a<=2147483647;a++) printf("%d\n",a); r...
6 6 votes
2 2 answers
329
329 views
GO Classes asked Jun 5
329 views
What is the output of the following code?#include <stdio.h int main() { int a[5] = {2, 4, 1, 3, 5}; int i, sum = 0; for (i = 0; i < 5; i++) { if (a[i] % 2 == 0) sum = sum...
13 13 votes
1 1 answer
381
381 views
GO Classes asked Jun 3
381 views
What is the output of the following code?#include <stdio.h int main() { int i, j, sum = 0; for (i = 1; i <= 4; i++) { for (j = 1; j <= 4; j++) { if (j == i) continue; if ...
13 13 votes
2 2 answers
462
462 views
GO Classes asked Jun 3
462 views
What is the output of the following code?#include <stdio.h int main() { int i, j, count = 0; for (i = 1; i <= 3; i++) { for (j = 1; j <= i; j++) { count = count + j; } } ...