Reprint: http://blog.csdn.net/u012434102/article/details/44886339
When you write data structures with C + +, the link list and two-fork tree often need to use a two-level pointer or a pointer to a reference, then when to use when not.First look at a simple C + + list operating procedures:
#include "stdio.h" #include "stdlib.h" #include "time.h" #define OK 1 #define ERROR 0 #define TRUE 1 #define FALSE 0 #
#include #include int Main1 (){Defines an uninitialized array of shaped pointers in which each element holds a separate pointerint *p[5];The size of P is 20 bytes; 64-bit operating system is 40 bytes, a pointer variable 8 bytesprintf ("%d\n", sizeof (p));P1 represents an integer pointer variable, and the pointer can only point to an array of 10 elements;int (*P1)
First, take a look at a small example of an array of pointers:
#include
Array pointers:
#include
The two names are different, of course, the meaning is different. I just started to see this scare, mainly Chinese is too broad and profound, the whole of this abbreviation is too professional, the people are around dizzy. It is easier to understand from the English explanation or the Chinese full name.
Array of pointers: array of pointers, which is used to store pointe
Nullptr
A null pointer is a pointer that does not point to valid data, previously expressed in 0, but this makes 0 both a pointer constant and an integer constant. C++11 still allows 0来 to represent a null pointer, so the expression nullptr==0 true, and using nullptr to represent a null
6.3.1 pointer operators and pointer expressions
There are two operators on pointers in C:
Operator: Takes the address operator, m is the address of the variable m.
* Operator: pointer operator, *PTR represents the variable to which it is pointing.
[Example 6-2] Enter two integers from the keyboard and output in order from large to small.
main() { int *p1,*p
1. References to pointers#include 2. Pointer to Pointer#include Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced. A reference to a pointer and a pointer to a pointer
Pointer to a constant, pointer constant, pointer constant to a constantThe first character is often called a constant pointer. They correspond to the following situations: const int * PI; or Int const * pi; int * const PI; const int * const PI; except for the letter pi, it is not easy to correctly write the "const", "*
# Ifndef _ test_h # DEFINE _ test_h // you can understand the pointer as an address. An address can record a data address, and a pointer is also a // data type, therefore, the pointer can also record the address of a pointer. # Include
Preface
Today, the error caused by the misuse of the pointer in the drive development: Unable to handle kernel NULL pointer dereference in virtual address xxxxxxxx. This error is what I encountered when I used DMA for the LCD driver, and the error caused by referencing an empty pointer when allocating the memory used for the DMA transfer. The error printing info
Constant pointer:const int* x indicates that the x being referred to is a constant and the pointer itself is a variable. If the pointer points to a constant, you must use a constant pointer
Pointer constant: int* const y indicates that the pointer itself is a constant, and
1
5
9
Summarized as follows:
???
Pis a level two pointer???
P? is the address of the cell that holds this level two pointer?: 0012ff40???
PThe value is: 0012ff44??? *
P? is
P
# Include
# Include
Using namespace STD;
Class
{};
Class B:Public
{};
Void F (B B)
{
Cout
}
Void F (A )
{
Cout
}
Int _ tmain (INT argc, _ tchar * argv [])
{
A * P1 = new B;
F (* P1); // call f (A )
A;
B * P2 = (B *) ;
F (* P2); // call f (B B)
/* F (* P2) Call analysis: F (B B) is equivalent to F (B * P), F (A A) is equivalent to F (A * P ),
F (* P2) is equivalent to F (P2), while P2 is B * type. Of course, F (B * P) is called, that is, F (B B) is called ).
The same applies to F (*
Tidy up the room, turn out a piece of stationery, think of the previous reading notes. As follows:typedef double (* fun-ptr) (int);Fun-ptr A pointer to a function that has an int parameter and returns a double. Analogy Imagination: Double fun-name (int a);Row pointer: double (* data) [5];Data is a pointer to an array that contains 5 double. Analogy imagination: D
1, the mouse right click Computer Desktop, in the menu select "Personalized."
2, in the "Control Panel personalization window" in the mouse click on the left-hand side of the "Change the mouse pointer" link text, as shown in the following figure.
3, in the mouse properties of the custom select "Normal Selection", and then click "Browse", select the corresponding icon, and so on double-click "Help select" Select the corresponding icon,
each () Definition and usage
The each () function generates an array of key names and key values of the elements that the array's current internal pointer points to, and moves the internal pointer forward.
The four elements included in the returned array: The key name is 0,1,key and value. The unit 0 and key contain the key names of the array cells, and 1 and value contain the data.
If the internal
#include #./aaa-----a[10]----a size:10, pa size;8, *pa size:1, *paa size:10When the first address of a character array is coerced into a char * pointer: sizeof (*PTR) is not the size of the array;C: When the first pointer of a character array is converted to a char * pointer, sizeof (*PTR) is not an array of size
Problem thinking:In a two-dimensional array, you cannot use the array name to express the first element of the array. The matrix no longer represents the address of the first element of the array.Array type:int array[5] is of type int[5], not int. INT[5] shows that this array has 5 elements, each element type is int.To define an array type:Array pointers:Examples of array types and arrays of pointers:1#include 2 3typedefint(AINT5) [5];4typedeffloat(AFLOAT10) [Ten];5typedefChar(ACHAR9) [9];6 7 in
Problem Description
Java programs deployed in the server (CentOS 64-bit) run, often encounter Oom, the server killed the Java main process. For the sake of prudence, the decision to optimize the JVM and reduce memory usage was not followed by an overbearing method of closing the Oom (a detailed analysis of the Linux kernel oom mechanism).
Solving Method
Referring to the compression of the JVM optimizations in the normal object pointer, on 64-bit machi
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.