Hello,
I have wrote a simple program that the it ask user to enter index of the element they want to display.
After user typed in first index, the program won't display the element until the second index is entered.
Here is my code
Code:
#include<stdio.h>
#include<stdlib.h>

main()
{

int array[] = {10,2,3,4,5};
int i;
 
scanf("%d\n", &i);

printf("%d\n", array[i]);

return 0;
}
What is the wrong in my code?