{"revision": {"id": "f3abc079-2f95-11f1-a3cc-e86a64d24d78", "node_id": "f3aadc3e-2f95-11f1-98f8-e86a64d24d78", "user_id": "edc3f576-2f95-11f1-900f-e86a64d24d78", "author": "foxhop", "data": "cpp Pointers\r\n==============\r\n\r\n**if p is a pointer**\r\n\r\n&p\r\n the memory address of p\r\n\r\n\\*p\r\n  the content that p points to\r\n\r\np\r\n the content of p (or the address that p points to)\r\n\r\nDynamic memory allocation or alias\r\n------------------------------------------\r\n\r\n**Useful but dangerous...**\r\n\r\n.. code-block:: cpp\r\n\r\n int *p, *q;\r\n \r\n p = new int;\r\n\r\n *p = 100;\r\n\r\n q = p;\r\n\r\n *q = 200;\r\n\r\n q = new int;\r\n\r\n *q = *p;\r\n\r\n delete p; // give memory that p occupied back to operating system\r\n  \r\n p = NULL; // set p to memory address 0", "source_format": "rst", "revision_number": 6, "created": 1317066363000}}