Why my code runs to infinite loop when I input a non integer from scanf?

82 Views Asked by At
#include<bits/stdc++.h>

#define ll long long

using namespace std;

int main()
{
    ll n;
    while(scanf("%lld",&n) != EOF) 
    {
        printf("hello\n");
    }
    return 0;
}

// When i input a non integer, the loop runs infinitely, which i think it should not. Can someone please explain?

0

There are 0 best solutions below