code_junkie

What do parentheses in a C variable declaration mean?

Nov 11th, 2011
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. int (*data[2])[2];
  2.  
  3. double (*elephant)[20];
  4.  
  5. int *(*crocodile)[15];
  6.  
  7. int (*data[2])[5];
  8.  
  9. int (*data[2])[5];
  10. int x1[5];
  11. data[0] = &x1;
  12. data[1] = &x1;
  13.  
  14. data[2] = &x1;//<--- out of bounds, crash data has no 3rd element
  15. int y1[10];
  16. data[0] = &y1;//<--- compiling error, each element of data must point to an int[5] not an int[10]
  17.  
  18. char *p;
  19.  
  20. int (*data[2])[5];
  21.  
  22. void **(*(*weird)[6])(char, int);
  23.  
  24. typedef void **(*sillyFunction)(char, int);
  25.  
  26. sillyFunction (*weird)[6];
Add Comment
Please, Sign In to add comment