| |

VerySource

 Forgot password?
 Register
Search
View: 1284|Reply: 10

VC pointer problem!

[Copy link]

3

Threads

13

Posts

9.00

Credits

Newbie

Rank: 1

Credits
9.00

 China

Post time: 2020-1-10 15:20:01
| Show all posts |Read mode
Ask you, VC ++ how to get the address of the pointer? ?
I tried to use the C ++ method "&". An error occurred. Can you give me an example?
Reply

Use magic Report

0

Threads

57

Posts

27.00

Credits

Newbie

Rank: 1

Credits
27.00

 China

Post time: 2020-1-11 20:54:01
| Show all posts
int a = 10;
int * b =&a;
int ** c =&b;
int *** d =&c;
Reply

Use magic Report

0

Threads

55

Posts

32.00

Credits

Newbie

Rank: 1

Credits
32.00

 China

Post time: 2020-1-13 11:36:01
| Show all posts
int * a;

int b;
b = 10;
a =&b;

The value of a is the address of b.
Reply

Use magic Report

3

Threads

13

Posts

9.00

Credits

Newbie

Rank: 1

Credits
9.00

 Unknown

 Author| Post time: 2020-1-13 15:45:02
| Show all posts
If b is a pointer, like you
int * a;

int * b;
b = 1;
How can a get the value of b? ? ?
Reply

Use magic Report

0

Threads

70

Posts

42.00

Credits

Newbie

Rank: 1

Credits
42.00

 China

Post time: 2020-1-13 19:54:02
| Show all posts
int ** a;
int * b;

a =&b;
Reply

Use magic Report

0

Threads

57

Posts

27.00

Credits

Newbie

Rank: 1

Credits
27.00

 China

Post time: 2020-1-14 12:09:01
| Show all posts
int * a;
int * a;
Is the same effect, just note that
int * a, b;
b is not declared as a pointer
int * a, * b;
Only 2 are pointers
Reply

Use magic Report

3

Threads

13

Posts

9.00

Credits

Newbie

Rank: 1

Credits
9.00

 China

 Author| Post time: 2020-1-15 18:45:01
| Show all posts
So if I get the address of a as an ASC code, is there any way to convert it to a character or an integer?
Reply

Use magic Report

2

Threads

18

Posts

15.00

Credits

Newbie

Rank: 1

Credits
15.00

 China

Post time: 2020-1-17 21:54:02
| Show all posts
The question is unclear. How can the address be an ASC code? The address is a 32-bit binary representation, and the ASC code is an 8-bit representation.
Reply

Use magic Report

0

Threads

36

Posts

22.00

Credits

Newbie

Rank: 1

Credits
22.00

 China

Post time: 2020-2-9 15:30:01
| Show all posts
int a = 1234;
int * ptr_a =&a;
long p = reinterpret_cast <long> (ptr_a);
Reply

Use magic Report

0

Threads

4

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

Post time: 2020-2-13 08:15:01
| Show all posts
The basic concepts are unclear
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list