web123456

C - subscripted value is neither array nor pointer nor vector error

This error occurred while writing code in C language;
Literally means that the value carrying the subscript is not an array or pointer.
Meaning: If you want to use a subscript for a variable name, it must be an array name or pointer name

The code segment I made at the time was

int id[100];

int main(){
   int n,m,id,k,i,j;
   scanf("%d%d",&n,&m);
   for(i=0;i<m;i++){
    scanf("%d",id+i);
   }

emmmmmmm
Have you seen it
Carelessly defined the global array id, but int id in the main function, so this problem occurred, which caused this error when I used the array later.

Why. . Be careful