firstly i am a noob in c, and i have seen this issue various times in c, and it happens most of the time
here is the code
#include <stdio.h>
int main ()
{
int n,a=5, A[n], i;
printf("value of n is\n");
scanf("%d\n", &n);
for(i=0; i<n; i++)
{
printf("value of A[%d] is %d\n", i, a++);
}
return 0;
}
so when it comes to output, something strange happens, the program asks for two input values
here see this
/tmp/bi8gJ4fc18.o
value of n is
10
7
value of A[0] is 5
value of A[1] is 6
value of A[2] is 7
value of A[3] is 8
value of A[4] is 9
value of A[5] is 10
value of A[6] is 11
value of A[7] is 12
value of A[8] is 13
value of A[9] is 14
so why does scanf require two inputs or when using scanf two inputs are to be provided, and it only considers the 1st input, what is happening here
also one more question, here in the stack-over-flow why I have to press enter two times in the body so that the next line actually goes to the next line in the output here
also, one more plz comment on this and have mercy on me, what is the proper way to search a question in sttack-over-flow, I mean i am never able to find the answer to my questions but when i ask a question others easily find some years old answer to it