C pointers : pointing to an array of fixed size
This question goes out to the C gurus out there: In C, it is possible to declare a pointer as follows: char (* p)[10]; .. which basically states that this pointer points to an array of 10 chars. The neat thing about declaring a pointer like this is that you will get a compile time error if you try to assign a pointer of an array of different size to p. It will also give you a compile time error if you try to assign the value of a simple char pointer to p. I tried this with gcc and it seems to work with ANSI, C89 and C99. It looks to me like declaring a pointer like this would be very useful -
0 upvotes
View original discussion ↗
Comments
Sign in or sign up to comment and upvote.
No comments yet.