0
#include<stdio.h>

int main()
{
    int i,n;
    printf("Enter the value ");
    scanf("%d",&n);
    int a[n];
    for(i=0;i<n;++i)
    {
        printf("Enter\n");
        scanf("%d\n",&a[i]);
    }
    for(i=0;i<n;i++)
    {
        printf("%d ",a[i]);
    }
    return 0;
}

here's the code.....here after scanning the 1st element of array it doesn't print the expected "Enter" it should while in the 2nd iteration. Also before printing the array as a final result, it demands one extra input for it to get printed which has no relation to the array elements....any explanation?

Lee Taylor
  • 7,155
  • 14
  • 29
  • 44

0 Answers0