pointer to string concept in c [closed]

To learn how to determine variable types in C, you should learn the ‘right-left rule’ which is explained here: http://ieng9.ucsd.edu/~cs30x/rt_lt.rule.html

Using the rule, and following the style of the ieng9 article here’s how you can determine the type in your example:

1. Find identifier                      char (*p)[10];
                                               ^
   "p is a"

2. Move right (stop at right paren)     char (*p)[10];
                                                ^
3. Stop at right paren and move left    char (*p)[10];
                                              ^
   "p is a pointer to"

4. Stop at left paren and move right    char (*p)[10];
                                                 ^
   "p is a pointer to array (size 10) of"

5. Out of symbols so move left          char (*p)[10];
                                        ^
   "p is a pointer to array (size 10) of char"

Or in other words, p is a pointer to a char array of size 10.

Leave a Comment