Array in c problem

Gauravs90

geek........
I'm using windows 7 64-bit and codeblocks mingw for compiling the following program

Code:
#include<stdio.h>

int main()
{
    int i,len,a[100];
    printf("enter the no. of elements\n");
    scanf("%d",&len);
    printf("enter the integers\n");
    for(i=0;i<len;i++)
    scanf("%d",a[i]);
    printf("integers entered are");
    for(i=0;i<len;i++)
    printf("\n%d",a[i]);
}

It compiles successfully, but when i run the generated exe file it fails at the step when i try to enter some no. in array... how can i fix it...
 

Santa Maria!

Journeyman
You forgot to take the address of each array item in your second scanf().

Code:
scanf("%d",a[i]);

should be

Code:
scanf("%d",[B]&[/B]a[i]);
 
Top Bottom