简体   繁体   中英

subscripted value is neither array nor pointer

I am writing a C program in which I am using an array of pipe for IPC.I am getting error "subscripted value is neither array nor pointer".Can any one tell me where did I do mistake?

here is the code where I get error:

  int p[100][2];
  //in for loop
  pipe(p[i-1]);
  //in child process
  close(p[i-1][0]);
  write(p[i-1][1], out, sizeof(NODE));
  //in parent process
  close(p[j][1]);
  ead(p[j][0], tmp, sizeof(NODE));

Pro tip: When resolving build errors in C don't pick any random error in the list and try to fix it. Start with the very first error generated as it is likely the root cause of many of the others that follow.

You must have a syntax error somewhere else in your code that is throwing off the declaration of int p[100][2] so that the identifier p is not appropriately parsed as a 2-dimensional array of type int allocated on the stack (or statically allocated as a global variable ... you didn't mention where it was declared.). Since the identifier is not parsed correctly, it then also throws off every other use of p in your code.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM