format ‘%d’ expects argument of type ‘int *’, but argument 2 has type 'char(*)(20)' [-wformat=]

Viewed 27

enter image description here

I am trying to use scanf() with the array a as follows:

printf("Enter a string for a[%d] :",i);
scanf("%d",&a[i]);

but I keep getting this error:

Error - format ‘%d’ expects argument of type ‘int ’, but argument 2 has type 'char()(20)' [-wformat=]

What is wrong with my code?

0 Answers
Related