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
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 '
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
#include #include int Main1 (){Defines an uninitialized array of shaped pointers in which each element holds a separate pointerint *p[5];The size of P is 20 bytes; 64-bit operating system is 40 bytes, a pointer variable 8 bytesprintf ("%d\n", sizeof (p));P1 represents an integer pointer variable, and the pointer can only point to an array of 10 elements;int (*P1)
1. References to pointers#include 2. Pointer to Pointer#include Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced. A reference to a pointer and a pointer to a pointer
Pointer to a constant, pointer constant, pointer constant to a constantThe first character is often called a constant pointer. They correspond to the following situations: const int * PI; or Int const * pi; int * const PI; const int * const PI; except for the letter pi, it is not easy to correctly write the "const", "*
# Ifndef _ test_h # DEFINE _ test_h // you can understand the pointer as an address. An address can record a data address, and a pointer is also a // data type, therefore, the pointer can also record the address of a pointer. # Include
# Include
# Include
Using namespace STD;
Class
{};
Class B:Public
{};
Void F (B B)
{
Cout
}
Void F (A )
{
Cout
}
Int _ tmain (INT argc, _ tchar * argv [])
{
A * P1 = new B;
F (* P1); // call f (A )
A;
B * P2 = (B *) ;
F (* P2); // call f (B B)
/* F (* P2) Call analysis: F (B B) is equivalent to F (B * P), F (A A) is equivalent to F (A * P ),
F (* P2) is equivalent to F (P2), while P2 is B * type. Of course, F (B * P) is called, that is, F (B B) is called ).
The same applies to F (*
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
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.