{"node_id": "f3aadc3e-2f95-11f1-98f8-e86a64d24d78", "revisions": [{"id": "f3abd0ca-2f95-11f1-9e0b-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; // create two pointers, named p and 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  \r\n\r\n delete q; // give memory that q occupied back to operating system\r\n\r\n q = NULL; // set q to memory address 0\r\n\r\n\r\n\r\nDynamic Allocation for arrays\r\n--------------------------------------------\r\n\r\n.. code-block:: cpp\r\n\r\n int size = 5;         // create an integer\r\n int *A;               // create an array of pointers\r\n\r\n A = new int[ size ];  // Ask for a certain size for your array\r\n\r\n A[0] = 10;            // Give values to Array\r\n A[1] = 20;\r\n A[2] = 30;\r\n A[3] = 40; \r\n A[4] = 50; \r\n\r\n //       8    32   32       36       40\r\n cout << &A << A << A + 0 << A + 1 << A + 2\r\n\r\n //       10      28      30\r\n cout << A[0] << A[1] << A[2] \r\n\r\n //       10      10       28        30\r\n cout << *A << *A + 0 << A + 1 << * A + 2\r\n\r\n delete []A;", "source_format": "rst", "revision_number": 9, "created": 1317067371000}, {"id": "f3abcbf0-2f95-11f1-9466-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; // create two pointers, named p and 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  \r\n\r\n delete q; // give memory that q occupied back to operating system\r\n\r\n q = NULL; // set q to memory address 0\r\n\r\n\r\n\r\nDynamic Allocation for arrays\r\n--------------------------------------------\r\n\r\n.. code-block:: cpp\r\n\r\n int size = 5; // create an integer\r\n int *A;       // create an array of pointers\r\n\r\n A = new int[ size ] \r\n\r\n", "source_format": "rst", "revision_number": 8, "created": 1317066901000}, {"id": "f3abc789-2f95-11f1-951c-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; // create two pointers, named p and 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  \r\n\r\n delete q; // give memory that q occupied back to operating system\r\n\r\n q = NULL; // set q to memory address 0\r\n\r\n\r\n\r\n\r\n", "source_format": "rst", "revision_number": 7, "created": 1317066530000}, {"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}, {"id": "f3abb950-2f95-11f1-8587-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  ", "source_format": "rst", "revision_number": 5, "created": 1317066223000}, {"id": "f3abb27e-2f95-11f1-93f5-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  ", "source_format": "rst", "revision_number": 4, "created": 1317066138000}, {"id": "f3abaafa-2f95-11f1-9f7e-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.. 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  ", "source_format": "rst", "revision_number": 3, "created": 1317066113000}, {"id": "f3aba310-2f95-11f1-bb25-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.. 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  ", "source_format": "rst", "revision_number": 2, "created": 1317066067000}, {"id": "f3ab9626-2f95-11f1-89a5-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)", "source_format": "rst", "revision_number": 1, "created": 1317065733000}], "count": 9}