深入理解c语言的指针(A thorough understanding of the pointer to the C language).docVIP

  • 4
  • 0
  • 约2.36万字
  • 约 28页
  • 2017-09-02 发布于河南
  • 举报

深入理解c语言的指针(A thorough understanding of the pointer to the C language).doc

深入理解c语言的指针(A thorough understanding of the pointer to the C language)

深入理解c语言的指针(A thorough understanding of the pointer to the C language) A pointer is a special variable in which the stored values are interpreted as an address in memory. To find out a four pointer to pointer to the content: the type of the pointer, pointer types, the value of the pointer or pointer memory, and the pointer itself occupy memory area. Let us explain separately. Declare a few pointers and put them in the example: Example one: (1) int*ptr; (2) char*ptr; (3) int**ptr; (4) int (*ptr) [3]; (5) int* (*ptr) [4]; Pointer type From a grammatical point of view, you simply remove the pointer from the pointer, and the rest is the type of the pointer. This is the type of pointer itself. Lets look at the types of pointers in the example: (1) int*ptr; / / pointer type is int* (2) char*ptr; / / pointer type is char* (3) int**ptr; / / pointer type is int** (4) int (*ptr) [3]; / / pointer type is int (*) [3] (5) int* (*ptr) [4]; / / pointer type is int* (*) [4] What about? Is it a simple way to find out the type of pointer? The type to which the pointer points When you pass the pointer to the memory area pointed to by the pointer, the type that the pointer points to determines what the compiler will look at as the content in that memory area. Grammatically, you just have to declare the pointer in the pointer, the name and the name of the pointer on the left, and the statement left, and the rest is the type that the pointer points to. Such as: (1) int*ptr; / / pointer type is int (2) char*ptr; / / pointer type is char (3) int**ptr; / / pointer type is int* (4) int (*ptr) [3]; / / pointer type is int ([3]) (5) int* (*ptr) [4]; / / pointer type is int* ([4]) In arithmetic operations of pointers, the type to which the pointer points is of great use. The type of pointer (the type of pointer itself) and the type pointed to by the pointer are two concepts. When you become more familiar with C, you will find that the pointer and mix together the type of this concept into the ty

您可能关注的文档

文档评论(0)

1亿VIP精品文档

相关文档