Question: When I open my page, messages output from in to out like a bubble event. Message 2, Message 1. But I need output Message 1, Message 2 like a tunnel event. Why did it happen so?

```
<div by-global-size="width:100%;height:5%;">
<div by-parent-size="width:50%;height:30%;">
</div>
</div>

.directive("byGlobalSize", function () {
    return {
        link: function (scope, element, attributes) {
            alert("Message 1");
        },
        restrict: "A",
        scope: true
    }
})
.directive("byParentSize", function () {
    return {
        link: function (scope, element, attributes) {
           alert("Message 2");
        },
        restrict: "A",
        scope:true
    }
});

```

I will not have two directives, this is just an example.

```
<div by-global-size="width:100%;height:5%;">
<div by-parent-size="width:50%;height:30%;">
<div by-parentChild-size="width:100%;height:5%;">
<div by-parentChildLittle-size="width:50%;height:30%;">
</div>
</div>
</div>
</div>

```

One more HTML example. From parent to child, I need build dom tree.

Answer: 
*array* - a contiguous series of elements that actually exists in memory. It *has an address*, usually considered as the address of the first element of the array.

*pointer* - a variable that *contains an address*. The address contained in a pointer may or may not point to actual memory.

Think of it this way - your home *has an address*. It exists *somewhere*, and you can put stuff in it - it's an *array*. You can put any address on an envelope and try to mail it. It may or may not get properly delivered for a lot of reasons - the street address written on an envelope is a *pointer*. And you can't store anything in that writing.
> 
> For the above program written in java, array notation cannot be used to access each byte of int.
> 
> 
> 

You're right

> 
> In the above C program, array notation can be alternatively used to access each byte of int.
> 
> 
> 

Yes, you can declare a `char` pointer, point it to the first byte of the `int` and then access each byte of the `int` variable with array notation.

The same way you can declare an array

```
char arr[3]={1,2,3};

```

And use it as a pointer

```
char *prt;
prt = arr;

```

That is equivalent to

```
ptr = & ( arr[0] ); // The address of the first element of arr

```

> 
> As per this program, How different is array from a pointer in C?
> 
> 
> 

To simplify (as per this program) an array is a pointer to the first element of the array.

`p0` is a pointer to an array whose items are `p0[0]`, `p0[1]`,...

**To clarify more:**

You can declare a variable as a pointer or as array.

In your code you don't declare arrays.

But as you use `p0[1]` you're treating `p0` as an array.

**Finally:**

I quote...

> 
> To understand the output after type casting
> 
> 
> 

See <https://stackoverflow.com/a/6752688/1579327>

The result of casting a larger type into a smaller one is undefined (implementation dependent) iF the smaller type is signed and the value of the larger type doesn't fit into the smaller one.