Pointer ---------- pointer in c, pointer, pointer array, and array pointer

Source: Internet
Author: User

Pointer ---------- pointer in c, pointer, pointer array, and array pointer
1. If a pointer defines a variable in the program and compiles the program, the system will automatically allocate memory units to the variable and allocate space of different lengths according to different types, for example, int occupies 4 bytes and char occupies 1 byte. Each byte in the memory unit has a number, which is the address. Because you can find the desired Variable unit through the address, it can be said that the address points to the variable unit. For example, a room number 301 is hung at the door of a room, which is the address of the room. This address is visualized as a pointer. For a memory unit, the address (number) of the Unit is the pointer, and the data stored in the unit is the content of the unit. Strictly speaking, a pointer is an address and a constant. A pointer variable can be assigned different pointer values, which are variables. However, pointer variables are often referred to as pointers. To avoid confusion, it is agreed that "Pointer" refers to an address, a constant, and "pointer variable" refers to a variable whose value is an address. The purpose of defining pointers is to access memory units through pointers. For example: int a = 12; int * p = & a; 2. pointer (second-level pointer) in simple terms, second-level pointer variable is the address of the first-level pointer variable. Example: int a = 12; int * p = & a; int ** = & p;

Related Article

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.