I am trying to read an unknown number of inputs using scanf
function.
int a[100];
int i = 0;
while((scanf("%d", &a[i])) != '\n')
i++;
// Next part of the code
But this function is not going to next part of the code, seems like there is an infinite while loop.
How Do I solve this logical error? Is there any other alternatives to scanf
like sscanf
to read integers into an array?