1. Summary of data types of pointersAbout the data type of the pointer
definition
meaning
int i;
Defining Shaping variables
int *p;
Defines a pointer variable p that only wants integer data
int a[n];
Defines an array of integers a, which has n elements
int *p[n];
Defines the pointer
The return value of a function pointer is an array of pointers, where the return value of an int function pointer is an array of pointers, and an int pointer is placed in the array.#include #include voidFunintA) {printf ("fun:%d\ n", a);}voidFUN1 (void(*f) (int),intA) {f (a);}intGunintA) {printf ("gun:%d\ n", a);}intGUN1 (intAint(*f) (int) {printf ("gun1:%d\ n",
I. Review pointer concepts:As early as in the second part of this series, I have elaborated on the essence of pointers. Today, we need to learn a pointer that points to another pointer address. Let's review the pointer concept first!When our program declares the following variables:Short int I;Char;Short int * PI;The p
The pointer pointing to the pointer was said long ago, but later I found it hard for many people to understand it. This time we will go over the pointer pointing to the pointer again.
Take a look at the following code and pay attention to the annotations in the Code:
# Include # Include Using namespace STD;Void print_
people who use OSG know that OSG's memory management approach uses smart pointers that allow OSG to handle object destruction by means of smart pointers. There are two smart pointer types in OSG, one is the ref_ptr we are familiar with, and the other one may not always be used by many people, but it's really very good observer_ptr. Both of these types appear as smart pointers, so what's the difference between them? Why are there two things like that?
In the C language, it is easy for people to get dizzy when they encounter pointers. Especially, although I know the pointer myth and the C language, I also know the trouble of pointers.
Today, when I read a book and saw a pointer to a function, I suddenly fell into a self-chaos state. This is an escape of psychological chaos! But I always need to understand it slowly, so I will try my best to summarize it
This article mainly introduces the C language of constant pointer and pointer constant difference, the need for friends can refer to
A constant pointer refers to a pointer to a constant, as the name suggests, is the pointer to a constant, that is, it can not point to the va
In this paper, some techniques for understanding C + + pointer arrays, array pointers, array names, and two-dimensional arrays are analyzed in detail. is a more important concept, I believe that for everyone's C + + program design has a certain role in helping.
First, about the array name
Suppose you have an array:
int a[3] = {1, 2, 3}
1. The array name represents the address of the first element of the array , noting that not the arra
A constant pointer to an object
Declare the pointer variable to the object as a const and initialize it so that the pointer value remains at its initial value and cannot be changed.
Copy Code code as follows:
Time T1 (10,12,15), T2;
Time * Const ptr1=t1;
ptr1=t2;
The general form of a constant point
Big talk function pointer and enumeration this pair of pointer enumeration, pointer Enumeration
I. Cause
(1)A function pointer is a pointer variable pointing to a function. It is essentially a pointer variable and a
1. pointer to the const objectConst int * P;This P is a pointer to an int-type const object. Const limits the type pointed to by the pointer P rather than P itself. That is to say, P itself is not a const. You do not need to initialize it during definition. You can also assign a value to P to point it to another const object. However, you cannot use P to modify t
My personal understanding about pointer arrays and pointer arrays in C language, pointer Arrays
I. pointer array and pointer Array
1. pointer Array
As the name suggests, an element is an array of all pointers. Its form is simila
Array name and pointer difference (array name is not a pointer, is the first address of the array), array pointer
Some time ago, after a C language lesson, the teacher said, "the array name is a constant pointer to the first address of the array ".
I have checked some of them over hundreds of times, including many tuto
how to correctly use pointers (pointers as output parameters) and structure body pointers as function parameters
In layman's terms, the pointer acts as an argument to a function, and the external value changes as it changes inside the function.
The following is a small project development essay: (with title related contents in error 3)
Error 1:
built-in.o:in function ' main ':
/root/winshare/imageplayer/main.c:17:undefined reference to ' Fb_open '
1. Pointer addition and subtraction operations1) pointer + integer will move backward sizeof (pointer type) * Whole number of memory units2) pointer-integer will move forward sizeof (pointer type) * Whole number of memory units3) Description: The compiler will not check whet
C language pointer learning, C language pointer
I have learned C language for a long time, but I don't have a very clear understanding of the pointers in it. I have the opportunity to study it well and summarize the learned knowledge. The knowledge comes from the explanation of C language pointers.I. pointer Concept
A pointer
Pointer knowledge (3): pointer and array, pointer knowledge Array
The concept of arrays is closely related to the concept of pointers. In fact, the array identifier is equivalent to the address of its first element, for example, int a [5]. array name a points to the address of its first element a [0.
The statement is as follows:
Int a [5];Int * p;
write in front Today, when I was using pointers, I found a mistake of my own. I just started thinking that the output of the two P are 6, at the time that two P refers to the same address, to modify the changes are all modified.This is a very low-level error, two P refers to the same address, but the address of the two pointers is not the same.
Like two people know how to go to the railway station, but can not say that the two people is a person, not to mention in the revision of a pe
Why is it called a universal pointer (generic pointer)?
Because the void pointer can hold any type of pointer, in Libev, Watcher->data is the void * type that holds the data for the asynchronous operation.
----
Look at the following example:
I first assign any type of pointer
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.