Question: I am having trouble with the Jquery scrollto command on iphone and ipads, it keeps flickering every time its used and gets stuck so I have decided to remove the code for these devices but am having trouble doing so. Here is the code I am trying to use to only show the javascript on a decktop browser.

```
<script type="text/javascript"> // <![CDATA[
if ((navigator.userAgent.indexOf('iPhone') != -1) || (navigator.userAgent.indexOf('iPod') != -1) || (navigator.userAgent.indexOf('iPad') != -1)) {
    document.write = "<meta name=\"viewport\" content=width=1024px, minimum-scale=1.0, maximum-scale=1.0 \/>";
}
else{document.write = "<script type=\"text/javascript\">
$(document).ready(function() {$('.nav').onePageNav({begin: function() {console.log('start');}, end: function() {console.log('stop');}, scrollOffset: 30});});
</script>";} // ]]>
</script>

```

The dev site can be found here: dev.greendealcumbria.com

Cheers

Answer: 
* The first one puts the array on the stack.
* The second one allocates it on the heap.

In the first case, the lifetime of the array is only the scope at which it is defined in. 
When it falls out of scope, it will be freed automatically so you don't have to do any clean up.

In the second case, the array lives beyond the scope where the pointer is declared. So you will need to manually `free()` it later to avoid a memory leak.
`some_struct* arr[10];` Will allocate the memory on the stack, while `some_struct** arr=(some_struct*)malloc(10*sizeof(some_struct*));` will allocate it on the heap.