The nature of pointers---how to determine the type of pointers

Source: Internet
Author: User

Preface: Description of Complex Type

To understand pointers, some of the more complex types appear, so I first introduce how to fully understand a complex type, to understand the complex type is very simple, there will be a lot of operators in a type, they also like ordinary expressions, have priority, the same priority and operation priority, So I summed up the principle: from the variable name, according to the operator priority combination, step-by-step analysis. Let's start with a simple type of analysis:

int p;

int *p;

This is a generic integer variable.

First, starting from P, first with the *, so that the P is a//pointer, and then combined with an int, indicating that the pointer to//the type of the content is int. So P is a pointer that returns the integer//type of data

First, starting from P, first with [], that P is a number//group, and then combined with an int, indicating that the elements in the array are integer//type, so P is an array of integral type data

Start with [] first from P, because its priority

int p[3];

int *p[3];

higher than *, so P is an array, and then combined with the *, the description//array of elements is a pointer type, and then combined with an int,//the type of the content pointed to by the pointer is an integral type, so//p is an array of pointers that return integral data

int (*p) [3]; First from P, first with the *, that P is a pointer//and then combined with the [] (and "()" This step can be ignored, just for//change the priority), indicating that the pointer to the content is a//array, and then combined with an int, indicating that the elements in the array is

Integral type. So P is a pointer to a number//group consisting of integral type data

int **p; First, starting from P, first with the *, that is, p is a pointer, then//and then combined with the *, indicating that the pointer points to the element is a pointer, then//and then combined with an int, indicating that the pointer to the element is the whole//type of data. Because two-level pointers and more advanced pointers are rarely used So the more complex types behind us are

Regardless of multi-level pointers, only one primary pointer is considered.

int p (int); From P, first with (), that P is a function, and then enter//() analysis, indicating that the function has an integer variable parameters

Then, with the outer int, it shows that the return value of the function is//an integral type of data

Int (*p) (int); Starting at p, first with the pointer, stating that p is a pointer, and/or (), and then with//(), indicating that the pointer is pointing to a function, and then in () with the//int, indicating that the function has an int parameter, and then with the outermost//int, that the return type of the function is integral type, so P is A finger

Pointer to a function that has an integer parameter and returns a type of integer

int * (*p (int))) [3]; Can skip first, do not look at this type, too complex//starting with P, first with (), stating that P is a function, and then into

Into (), with an int, the function has an integer variable//parameter, and then combined with the outer *, the function returns a pointer, and then to the outermost layer, first with [], the description//return pointer to an array, and then with the *, said// The element in the Ming array is a pointer, and then it is combined with an int to indicate that the contents of the//PIN point are integer data. So P is a function that has a parameter of one//integer data and returns a pointer variable that is an array consisting of an integer pointer variable.

Speaking of here is almost, our task is so much, understand these types, other types for us is also a side dish, but we generally do not use too complex type, which will greatly reduce the readability of the program, please use caution, the above several types are enough for us to use.

1. Pointers

A pointer is a special variable, and the value stored in it is interpreted as an address in memory. To make sense of a pointer, you need to understand the four aspects of the pointer: the type of the pointer, the type that the pointer is pointing to, the value of the pointer, or the memory area that the pointer is pointing to, or the memory region that the pointer itself occupies. Let's explain separately.
Let's declare a few pointers for example:

Example one:

(1) Int*ptr; (2) Char*ptr; (3) Int**ptr; (4) int (*PTR) [3];(5) int* (*PTR) [4];

1. Type of pointer

   From a grammatical point of view, you simply remove the pointer name from the pointer declaration statement, and the remainder is the type of the pointer. This is the type that the pointer itself has. Let's look at the types of pointers in example one:

(1) The type of the int*ptr;//pointer is int* (2) The char*ptr;//pointer is of type char* (3) int**ptr;//pointer is int** (4) int (*ptr) [The type of the 3];//pointer is int (*) [3]

(5) int* (*ptr) [4];//pointer type is int* (*) [4] How about the method of finding the type of the pointer is not very simple?

2. The type that the pointer points to

   When you use a pointer to access the memory area pointed to by the pointer, the type that the pointer points to determines what the compiler will look for in that memory area.

Syntactically, you only have to remove the pointer name and the pointer to the left of the name in the pointer declaration, and all that remains is the type that the pointer points to. For example:

(1) Int*ptr; The type that the pointer points to is int
(2) Char*ptr; The type that the pointer points to is Char
(3) Int**ptr; The type that the pointer is pointing to IS int*
(4) int (*PTR) [3]; The type that the pointer points to is int () [3] (5) int* (*PTR) [4]; The type pointed to by the pointer is int* () [4] in the arithmetic operation of the pointer, the type pointed by the pointer has a great effect. The type of the pointer (that is, the type of the pointer itself) and the type that the pointer points to are two concepts. When you

As you become more familiar with C, you will find that the concept of "type", which is mixed with pointers, is divided into "type of pointer" and "type pointed by pointer", which is one of the key points of mastery of pointers. I read a lot of books, found that some poorly written books, the pointer to the two concepts stirred together, so look at the contradiction between the book, the more confused look.

3. The value of the pointer----or the memory area or address to which the pointer is pointing

The value of the pointer is the value stored by the pointer itself, which is treated as an address by the compiler, not a generic value. In a 32-bit program, the value of all types of pointers is a 32-bit

Integer because the memory address in the 32-bit program is all 32 bits long. The memory area that the pointer points to is the memory address from which the value of the pointer is represented, and the length of the memory area of the SI zeof (the type to which the pointer is pointing). Later, we say that the value of a pointer is XX, which is equivalent to saying that the pointer to an XX-led address of a piece of memory area; we say that a pointer points to a region of memory, which is equivalent to saying that the value of the pointer is the first address of the memory area.

   The memory area that the pointer points to and the type that the pointer points to are two completely different concepts. In example one, the pointer points to a type that already exists, but because the pointer is not initialized, the memory area it points to is nonexistent, or meaningless.
   Later, every time you encounter a pointer, you should ask: What is the type of pointer? What is the type of pointer? Where does the pointer point? (Key Note)

4 the memory area occupied by the pointer itself

How much memory does the pointer itself occupy? You just need to use the function sizeof (the pointer type) to get a look. In a 32-bit platform, the pointer itself occupies a length of 4 bytes.

   The concept of memory occupied by the pointer itself is useful when judging whether a pointer expression (which is explained later) is an lvalue.

2, the arithmetic operation of the pointer

The pointer can add or subtract an integer. The meaning of this operation of the pointer and the addition and subtraction of the usual value
The meaning of the operation is different, in units. Example: Example two:

Char a[20];
int *ptr= (int *) A; Forcing a type conversion does not change the type of a ptr++;

In the example above, the type of the pointer ptr is int*, and the type it points to is int, which is initialized to point to integer variable a. In the 3rd sentence, the pointer ptr is added 1, and the compiler handles this: it adds the value of the pointer ptr to sizeof (int), and in 32-bit programs, it is added 4, because in 32-bit programs, int accounts for 4 bytes. Since the address is in bytes, the address pointed to by PTR is incremented by 4 bytes from the address of the original variable A to the high address direction. Since the length of the char type is one byte, the original ptr is the four bytes starting at Unit No. 0 of array A, pointing to the four bytes from array a starting at unit 4th.

   We can use a pointer and a loop to iterate through an array, looking at an example:

Example three:

int Array[20]={0};int *ptr=array;for (i=0;i<20;i++) {

(*ptr) + +; ptr++;

}
This example adds 1 to the value of each cell in an integer array. Because each loop has the pointer ptr

Add 1 units, so each loop can access the next cell of the array. Look again at the example:

Example four:

Char a[20]= "You_are_a_girl";
int *ptr= (int *) A;
ptr+=5;
In this example, PTR is added with 5, and the compiler handles this: the pointer ptr

The value plus 5 by sizeof (int), in 32-bit program is added 5 times 4=20. Because the unit of the address is byte, the current PTR points to an address that is 20 bytes to the high address direction than the address pointed to by PTR after 5. In this example, PTR, which is not added to 5, points to the four bytes starting at Unit No. 0 of array A, plus 5, and PTR points to the legal range of array A. Although this situation may be problematic in application, it is syntactically possible. This also shows the flexibility of the pointer.

If PTR is subtracted by 5 in the example above, then the process is much the same, except that the value of PTR is subtracted by 5 by sizeof (int), and the new PTR points to an address that moves 20 bytes to the lower address direction than the address pointed to by the original PTR.

Let me give you another example: (a misunderstanding) example five:

    #include <stdio.h>    int main ()    {

Char a[20]= "You_are_a_girl"; Char *p=a;
Char **ptr=&p;

printf ("p=%d\n", p);//printf ("ptr=%d\n", PTR),//printf ("*ptr=%d\n", *ptr);p rintf ("**ptr=%c\n", **ptr);

ptr++;

printf ("ptr=%d\n", PTR),//printf ("*ptr=%d\n", *ptr);p rintf ("**ptr=%c\n", **ptr);

}

Error one, the output answer is Y and O

Myth: PTR is a two-level pointer to a char, and when executed ptr++, the pointer is added to a sizeof (char), so the output, as a result, may be a result of a small number of people. Misunderstanding two, the output answer is Y and a
Myth: PTR is pointing to a char * type, and when executing ptr++, the pointer will be given a sizeof (char *) (there might be someone who thinks the value is 1, that will get the wrong answer, this value should be 4, refer to the previous content), i.e. &p+4; Do not perform a single value operation

Does it point to the fifth element in the array? The result of the output is not the fifth element in the array? The answer is No.
Positive solution: The type of PTR is char * *, the type pointed to is a char * type, the address that points to is the address of P (&p), when executed ptr++, the pointer will be added to a sizeof (char*), that is &p+4; * (&p+4) Point to, this you ask God, or he will tell you where? So the final output will be a random value, perhaps an illegal operation.

To summarize:
After a pointer ptrold plus (minus) An integer n, the result is a new pointer ptrnew,ptrnew of the same type as the Ptrold, and the same type that ptrnew points to and the type that ptrold points to. The value of ptrnew will increase (decrease) by N by sizeof (the type that the Ptrold points to) by more than the value of Ptrold. That is, the memory area pointed to by Ptrnew will move n by sizeof (the type pointed to by Ptrold) by the memory area pointed to by Ptrold to a high (low) address direction.

Add and subtract pointers and pointers: Two pointers cannot be added, which is illegal, because after the addition, the resulting results point to a place that is not known and meaningless. Two pointers can be subtracted, but must be of the same type, generally used in the array, not much to say.

3. Operators & and *

Here & is the address operator, * is the indirect operator.

The result of the &a operation is a pointer, the type of the pointer is a type of a, a pointer to the type of a, the pointer to the address, that is the address of a.

The result of *p's operation is very multifarious. In short *p The result is what P points to, this thing has these characteristics: its type is the type of P, which occupies the address that P points to.

Example VI:

int a=12;p=&a;

*p=24;

ptr=&p;

*ptr=&b;

**ptr=34;

int b; int *p; int **ptr;
The result of the &a is a pointer to the type int*, the type that is//int, and the address that points to is a.
The result of *p, where its type is int, it occupies an address that//p points to, and obviously *p is the variable A.
The result of &p is a pointer, the type of the pointer is the type of P plus a *,//here is int * * *. The type that the pointer points to is the type of P, which is int*. The address that the pointer points to is the pointer P's own address. *ptr is a pointer, the result of &b is also a pointer, and the two pointers//type and the type of the point is the same, so with &b to give *ptr//value is no problem.
The result of the *ptr is what PTR points to, here is a pointer,//The pointer is again * operation, the result is an int type of variable.

4. Pointer expression

    If the result of an expression is a pointer, then the expression is called a pointer-table.
    Here are some examples of pointer expressions:

Example VII:

Example VIII:

int A,b;int Array[10];int *pa;pa=&a;int **ptr=&pa;*ptr=&b;pa=array;pa++;

Char *arr[20];
Char **parr=arr;//If you think of arr as a pointer, arr is also a pointer expression char *str;
Str=*parr;
str=* (parr+1);
str=* (parr+2);

Because the result of a pointer expression is a pointer, the pointer expression also has four features that the pointer has: the type of pointer, the type that the pointer points to, the memory area that the pointer is pointing to, and the memory that the pointer itself occupies.

&a is a pointer expression. &PA is also a pointer expression. Both *ptr and &b are pointer expressions.

This is also an expression of pointers.

*parr is a pointer expression//* (parr+1) is a pointer expression//* (parr+2) is a pointer expression

Well, when the result pointer of a pointer expression has explicitly had the memory occupied by the pointer itself, the pointer expression is an lvalue, otherwise it is not an lvalue. In example VII, &A is not an lvalue because it does not yet occupy a definite amount of memory. *ptr is an lvalue, because *ptr this pointer has occupied the memory, in fact *ptr is the pointer PA, since PA has in memory has its own position, then *ptr of course also has its own position.

5. The relationship between arrays and pointers

    The array name of an array can actually be seen as a pointer. Look at the following example:

Example nine:

Example Ten:

Intarray[10]={0,1,2,3,4,5,6,7,8,9},value;

VALUE=ARRAY[0];
VALUE=ARRAY[3];
VALUE=ARRAY[4];
In the example above, the array name arrays typically represent the array itself, and the type is int[10], but if you think of array as a pointer, it points to the No. 0 cell of the array, the type is int*, and the type that points to is the type of the array cell, which is int. So it's not surprising that *array equals 0. Similarly, array+3 is a pointer to the 3rd cell of the array, so * (array+3) equals 3. Other and so forth.

Char *str[3]={  "hello,thisisasample!",  "hi,goodmorning.",  "Helloworld"

};
chars[80];strcpy (S,str[0]); strcpy (s,str[1]); strcpy (s,str[2]);

May also be written as strcpy (S,*STR);//may also be written as strcpy (s,* (str+1));//may also be written in strcpy (s,* (str+2));

Can also be written as: value=*array;//can also be written as: value=* (array+3);//may also be written as: value=* (array+4);

In the above example, STR is an array of three cells, each of which is a pointer to a string. With the pointer array name STR as a pointer, it points to the No. 0 element of the array, which is of type char * *, which is the type char *.

*STR is also a pointer to the type char *, which is the type char, and the address it points to is the string "hello,thisisasample!" The address of the first character, which is the address of ' H '. Note: The string equivalent is an array, stored in memory as an array, except that the string is an array constant, the content is immutable, and can only be an rvalue. If you look at a pointer, he is a constant pointer and a pointer constant.

Str+1 is also a pointer to the 1th element of the array, whose type is char**, and the type it points to is char*.

* (str+1) is also a pointer, its type is char*, it points to a type of char, which points to "hi,goodmorning." The first character ' H '

The following summarizes the array names of arrays (arrays are also stored in arrays): Declaring an array of type array[n], the array name arrays has two meanings: first, it represents the entire array, its type is type[n]; second, it is a constant pointer, and the type of the pointer is type*, the pointer to the type, which is the type of the array cell, the memory area that the pointer points to is the No. 0 cell of the array, which occupies a separate memory area, noting that it is different from the memory area occupied by the group No. 0 unit. The value of the pointer cannot be modified, that is, an expression like array++ is wrong.

Array names in different expressions can play different roles.

In the expression sizeof (array), array name arrays represent the array itself, so the sizeof function detects the size of the entire array.
In the expression *array, array acts as a pointer, so the result of this expression is the value of cell number No. 0. sizeof (*array) measured the size of the array element.

Expression array+n (where n=0,1,2,.....) , array acts as a pointer, so the result of the array+n is a pointer, which is of type *, and it points to the type, which points to the array nth unit. So sizeof (ARRAY+N) measured the size of the pointer type. The result in a 32-bit program is 4

Example 11:

int array[10];
int (*ptr) [10];
Ptr=&array;:
In the example above, PTR is a pointer, it is of type int (*) [10], he points to the type int[10], and we initialize it with the first address of the entire array. In statement Ptr=&array, array represents the array itself.

The function sizeof () is mentioned in this section, so let me ask if sizeof (the pointer name) measured the size of the pointer itself, or the size of the type to which the pointer is pointing? The answer is the former. For example:
int (*ptr) [10];

In the 32-bit program, there are: sizeof (int (*) [ten]) ==4sizeof (int[10]) ==40

sizeof (PTR) ==4 in fact, sizeof (the object) measured the size of the object's own type, not the size of any other type.

6. The relationship between the pointer and the structure type

    You can declare a pointer to a struct type object.

Example 12:

       struct MyStruct       {
         int A;         int b;         int C;

};
struct MyStruct ss={20,30,40};

The struct object SS is declared, and the members of the SS are initialized to 20,30 and 40. struct MyStruct *ptr=&ss;

A pointer to the struct object SS is declared. It is of the type

MyStruct *, the type it points to is mystruct. int *pstr= (int*) &ss;

A pointer to the struct object SS is declared. But the pstr and/or the type of PTR it is pointing to is different.

How can I access the three member variables of SS through pointer ptr? Answer:

ptr->a; Point to the operator, or you can (*PTR). A, it is recommended to use the former ptr->b;

ptr->c;

How can I access the three member variables of SS through pointer pstr? Answer:

*pstr;* (pstr+1); * (pstr+2)

A member of the SS was accessed. Member B of the SS was accessed. Member C of the SS was accessed.

Although I have raised the above code in my msvc++6.0, it is not normal to use PSTR to access struct members, and to illustrate why it is not normal, let's look at how to access the elements of an array by pointers: (replace the struct with an array)

Example 13:

int array[3]={35,56,37};
int *pa=array;
The method by which the pointer PA accesses the array of three cells is:

*pa;* (pa+1); * (pa+2);

Access to Unit NO. 0//access to Unit 1th//access to Unit 2nd

The format is the same as the format of the informal method of accessing struct members through pointers.

All the C + + compilers, when arranging cells in an array, always store each array cell in a contiguous storage area, with no gaps between the cells and the cells. However, when you store individual members of a structure object, in a certain compilation environment, you may need to align the words or the two words or something else, and you need to add several "padding bytes" between the adjacent two members, which leads to a

There may be several bytes of space between the individual members. So, in example 12, even though *pstr accesses the first form of the struct object ss

Variable A, there is no guarantee that * (PSTR+1) will have access to struct member B. Because there may be several padding bytes between member A and member B, it is possible that * (PSTR+1) has access to these padding bytes. This also proves the flexibility of the pointer. If your goal is to see if there are any padding bytes between the members of each structure, hey, that's a good idea. However, the correct way for pointers to access struct members should be to use the pointer ptr method in example 12.

7. The relationship between pointers and functions

A pointer can be declared as a pointer to a function.
int fun1 (char *,int);
Int (*pfun1) (char *,int);
PFUN1=FUN1;
int a= (*PFUN1) ("ABCDEFG", 7);//functions are called through function pointers. You can use a pointer as a parameter to a function. In a function call statement, you can use a pointer expression as an argument.

Example 14:

int fun (char *);
Inta
Char str[]= "ABCDEFGHIJKLMN"; A=fun (str);
int fun (char *s)
{
int num=0;
for (int i=0;;)
{

            num+=*s;s++;       }

return num; }

The function fun in this example counts the sum of the ASCII values of each character in a string. As I said earlier, the name of the array is also a pointer. In a function call, when the STR is passed to the parameter s as an argument, the value of STR is actually passed to the address that the s,s points to, but Str and s each occupy their respective storage space. The self-adding 1 operation of S in the function body does not imply that STR is also self-added to the 1 operation.

8. Pointer type conversion

When we initialize a pointer or assign a value to a pointer, the left side of the assignment number is a pointer, and the right side of the assignment number is a pointer expression. In the example above, in most cases, the type of the pointer is the same as the type of the pointer expression, and the pointer points to the same type as the pointer expression.

Example 15:

       float f=12.3;       Float *fptr=&f;       int *p;

In the example above, what if we want the pointer p to point to the real f? Is it using the following statement?

p=&f;

Wrong. Because the type of pointer p is int *, the type it points to is int. The result of the expression &f is a pointer, the type of the pointer is float *, and the type it points to is float. There is no inconsistency between the two, the direct assignment method is not possible. At least on my msvc++6.0, the assignment statement for the pointer requires the same type on both sides of the assignment, and the same type, and the other compiler I haven't tried, you can try. In order to achieve our goal, a "forced type conversion" is required:
p= (int*) &f;
If there is a pointer p, we need to change its type and the type it is pointing to
Tyep *type, then the syntax format is: (TYPE *) p;

      The result of forcing the type conversion is a new pointer that is the type of the new pointer

Type *, which refers to the kind that is the address that the original pointer points to. All the properties of the original pointer p have not been modified. Remember

A function if you use a pointer as a parameter, you must ensure that the type is consistent during the combination of the arguments and the parameters of the function call statement, otherwise you need to cast

Example 16:

       void Fun (char*);       int a=125,b;       Fun ((char*) &a);       void Fun (char*s)       {

Charc;
c=* (s+3); * (s+3) =* (s+0); * (s+0) =c;c=* (s+2); * (s+2) =* (s+1); * (s+1) =c;
}
Note that this is a 32-bit program, so the int type takes up four bytes, and the char type takes up one byte. The function of fun is to reverse the order of four bytes of an integer. You notice? In a function call statement, the result of the argument &a is a pointer to the type int *, which is the type int. Parameter the type of the pointer is char *, which is the type of char. Thus, during the combination of the arguments and the parameters, we have to do a conversion from the int * type to the char * type. With this example, we can imagine the compiler's process of converting: The compiler constructs a temporary pointer char *temp, then executes the temp= (char *) &a, and finally passes the value of temp to S. So the final result is that the type of S is char *, which is the type char, and the address that it points to is

The first address of a.
We already know that the value of the pointer is the address pointed to by the pointer, in a 32-bit program,

The value of the pointer is actually a 32-bit integer. Would it be possible to assign an integer as a pointer to the pointer directly? Just like the following statement:
unsigned int A;
TYPE *ptr;

Type is Int,char or struct type, and so on.

a=20345686;
ptr=20345686;
ptr=a; compile it. It turns out that the last two statements are all wrong. So we're not going to be able to do that? No, there are ways:

unsigned int A;
TYPE *ptr; Type is Int,char or struct type, and so on.
A=n//n must represent a legal address;
Ptr= (type*) A; Oh, that's it.
Strictly speaking, the (type *) is not the same as the (type *) in the pointer type conversion. Here (type*) means to treat the value of unsigned integer a as an address. It is emphasized that the value of a must represent a valid address, otherwise an illegal operation error occurs when you use PTR.

Think about the reverse, take the pointer to the address that the pointer value as an integer to take out. It's perfectly possible. The following example shows that the value of a pointer is taken as an integer, and then the integer is assigned to a pointer as an address:

Our goal is to make the pointer ptr point to the address 20345686//our goal is to make the pointer ptr point to address 20345686

Example 17:

int a=123,b;int *ptr=&a;char *str;b= (int) ptr;str= (char*) b;

Take the value of the pointer ptr as an integer.

Assign the value of this integer as an address to the pointer str. Now we know that the value of the pointer can be taken as an integer

To assign an integer value as an address to a pointer.

9, the safety of the pointer

Look at the following example:

Example 18:

Char s= ' a '; int *ptr; ptr= (int *) &s; *ptr=1298;

The pointer ptr is a pointer to an int * type that points to the type int. The address it points to is the first address of S. In a 32-bit program, S occupies one byte and the int type occupies four bytes. The last statement changes not only the one byte that s occupies, but also the three bytes of the high address direction that is adjacent to S. What are these three bytes for? Only the compiler knows, and the person who writes the program is not likely to know. Perhaps these three bytes store very important data, perhaps these three bytes is exactly a code of the program, and because of your sloppy application of the pointer, the value of the three bytes has been changed! This can cause a crash error. Let's look at one more example:

Example 19:

       char A;       int *ptr=&a;       ptr++;       *ptr=115;

This example is fully compiled and can be executed. But you see? The 3rd sentence after the pointer ptr is self-adding 1, PTR points to the high address direction adjacent to the shaping variable a

Block of storage. What's in this storage area? We don't know. It is possible that it is a very important piece of data, possibly even a code. And the 4th sentence actually writes a piece of data to this storage area! This is a serious mistake. So when using pointers, the programmer must be very clear: where my pointer is pointing. When accessing an array with pointers, be careful not to go beyond the lower and upper bounds of the array, or it will cause similar errors.

In the coercion type conversion of a pointer: ptr1= (type *) PTR2, if sizeof (PTR2 is of a more than sizeof type), it is safe to use the pointer ptr1 to access the store that the ptr2 points to. If sizeof (the type of PTR2) is less than sizeof (the type of PTR1), it is unsafe to use the pointer ptr1 to access the store that the ptr2 points to. As for why, the reader combined with an example Balai think, should understand.

10. Concluding remarks

Now do you feel that the pointer is no longer what you think you are afraid of, if your answer is: Yes, I am not afraid! Haha, congratulations, you have mastered the essence of C language, c the only difficulty is the pointer, the pointer to the other side dishes, it is important to practice, OK, let us first pause C's journey, start our C + + programming is very convenient for the underlying operation of the language, but the development of large programs I think there is no C + + convenience, at least maintenance is not very good. and C + + is an object-oriented language, is now basically an object-oriented world, so it is recommended to learn C + +. C + + is a difficult to learn to use the language, to really master C + + is not so easy, will be the basic study after the school data structure bar, algorithm is eternal, programming language endless, never learn. After learning to seriously chew the STL this bone bar, recommended books--------Paradigm programming and STL and STL source code analysis. If you meet this requirement, once again congratulate you, you are already a program master, even can be said to be an algorithm master, because STL has a large number of elite and efficient algorithm.

The nature of pointers---how to determine the type of pointers

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.