Thursday 29 June 2017

C Pointers


  int *p[10]; ==> This is an array of pointers

int (*p)[10];==>This is a pointer to a 10 element array 

dangling pointer
==>A pointer which points to an object that no longer exists. Its a pointer referring to an area of memory that has been deallocated.


reference counters==>Using reference counters which keep track of how many pointers are pointing to this memory location can prevent such issues. The reference counts are incremented when a new pointer starts to point to the memory location and decremented when they no longer need to point to that memory. When the reference count reaches zero, the memory can be safely freed.

======
*(*(p+i)+j) == p[i][j].  



No comments:

Post a Comment