Pointer type and pointer type description

Source: Internet
Author: User
Pointer type and pointer type description 2010-03-17 1774 people read comments (1) collect reports compiler C

 

1. pointer type

From the perspective of syntax, you only need to remove the pointer name in the pointer declaration statement, and the remaining parts

This is the pointer type. This is the type of the pointer. Let's take a look

Pointer types:

(1) int * PTR; // the pointer type is int *

(2) char * PTR; // the pointer type is char *

(3) int ** PTR; // the pointer type is int **

(4) int (* PTR) [3]; // the pointer type is int (*) [3]

(5) int * (* PTR) [4]; // the pointer type is int * (*) [4]

How is it? Is it easy to find the pointer type?

2. Type pointed to by pointer

When you access the memory area pointed to by the pointer, the type pointed to by the pointer determines

The compiler treats the content in the memory area as something.

In terms of syntax, you only need to declare the pointer name and the pointer sound on the left of the name in the pointer declaration statement.

The identifier * is removed, and the rest is the type pointed to by the pointer. For example:

(1) int * PTR; // The Pointer Points to an int type.

(2) char * PTR; // The Pointer Points to a char type.

(3) int ** PTR; // The type pointed to by the pointer is int *

(4) int (* PTR) [3]; // The type pointed to by the pointer is int () [3]

(5) int * (* PTR) [4]; // The type pointed to by the pointer is int * () [4]

In pointer arithmetic operations, the type pointed to by the pointer has a great effect.

The pointer type (the pointer type) and the pointer type are two concepts. When you

When you are getting familiar with C, you will find that the concept of "type" mixed with pointers is divided

The concepts of "pointer type" and "pointer type" are one of the key points to be proficient in pointers.

I read a lot of books and found that some poorly written books bring together the two concepts of pointers,

As a result, the conflicts between books become increasingly confusing.


Source: http://blog.csdn.net/gwonph/article/details/5389397>  



From Weizhi note (wiz)



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.