Monday 15 April 2013

c++ - what does size of array and size of its pointer means? -


Recently, I read the code jerk and it confuses

  fixed string const Dirs [6] = {"-n", "-ne", "-se", "-s", "-sw", "-nw"}; Int a = sizeof (dirs) / sizeof (* dirs);   

And the size of an array is equal to 6, which is 6.

So my question is:

  1. What does the shape show (DIR)? What is the size of the total array?

  2. What do you represent (Dears) of size?

  3. represents the size size

    Thus, sizeof (* dirs) * number of elements = sizeof (dirs), because the number of elements * the size of each element is the size of the whole array

    Thus, the number of elements = size ( DIR) / size (* Diaz).

No comments:

Post a Comment