| |

VerySource

 Forgot password?
 Register
Search
View: 928|Reply: 4

Is there any difference in this definition?

[Copy link]

1

Threads

10

Posts

9.00

Credits

Newbie

Rank: 1

Credits
9.00

 China

Post time: 2020-2-1 11:00:01
| Show all posts |Read mode
int x = 1; int y = 2; int z = 3;
int * a [10] = {&x,&y,&z}; // The pointer array stores the pointer

int (* a) [10] = {&x,&y,&z}; // This definition fails to compile
Reply

Use magic Report

0

Threads

55

Posts

44.00

Credits

Newbie

Rank: 1

Credits
44.00

 Invalid IP Address

Post time: 2020-3-13 03:00:01
| Show all posts
int aaa [10];
int (* a) [10] =&aaa;
Reply

Use magic Report

0

Threads

2

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-3-13 17:45:01
| Show all posts
Not the same, the first a is an array of pointers and the second a is a pointer to an array.
Reply

Use magic Report

0

Threads

12

Posts

10.00

Credits

Newbie

Rank: 1

Credits
10.00

 China

Post time: 2020-3-13 18:30:02
| Show all posts
int * a [10] = {&x,&y,&z};
a is a data name containing 10 data, each data type is int *

int (* a) [10] = {&x,&y,&z};
a is a pointer to an int array of length 10
Reply

Use magic Report

1

Threads

10

Posts

9.00

Credits

Newbie

Rank: 1

Credits
9.00

 China

 Author| Post time: 2020-3-17 16:00:01
| Show all posts
Means not the address of a pointer constant stored by a
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