- 4
- 0
- 约2.36万字
- 约 28页
- 2017-09-02 发布于河南
- 举报
深入理解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
您可能关注的文档
- 04打造高效执行力组织第三步(04, to build efficient implementation of organizational third steps).doc
- 山地车组装办法(Method for assembling mountain bike).doc
- 山药优质标准化生产周年管理技1(Annual management technique for quality standardization production of Chinese yam 1).doc
- 山建计算机组装与维护 选修课答案- 于宽老师(Answers to optional courses on computer assembly and maintenance).doc
- 1815_1914年欧洲均势关系探析(Analysis of European balance of power in 1815_1914).doc
- 嵌入式填空(Embedded cloze).doc
- 巧借诗词歌赋给宝宝起一个吉祥的名字(Take poetry baby an auspicious name).doc
- 巧克力囊肿不能拖超声引导穿刺法可有效治疗(Chocolate cyst cannot be dragged by ultrasound guided puncture, but it can be treated effectively).doc
- 巧妙面对减肥平台期 解决瘦不下来的困扰(Clever platform to lose weight to solve the problem of thin down).doc
- 嵌入式linux内核编译错误的一些解决办法(Some solutions to compile errors in embedded Linux kernel).doc
- 浙江省温州市2024-2025学年七年级上学期语文期末考查卷.docx
- 精品解析:北京市建华实验学校2024-2025学年七年级下学期期中英语试题(原卷版).docx
- 精品解析:北京市通州区2024-2025学年七年级下学期期末考试英语试卷(原卷版).docx
- 精品解析:北京市回民学校2024-2025学年九年级上学期期中语文试题(解析版).docx
- 精品解析:北京市海淀区2025-2026学年九年级上学期期末语文试题(解析版).docx
- 精品解析:北京市东城区汇文中学2025-2026学年八年级上学期期中语文试题(原卷版).docx
- 精品解析:北京市回民学校2024-2025学年九年级上学期期中语文试题(原卷版).docx
- 精品解析:2024-2025学年广东省广州市从化区街口镇中心小学人教版五年级上册期中测试数学试卷(解析版).docx
- 精品解析:北京市通州区2024-2025学年七年级下学期期末考试英语试卷(解析版).docx
- 精品解析:北京市建华实验学校2024-2025学年七年级下学期期中英语试题(解析版).docx
原创力文档

文档评论(0)