Ask Your Question
4

What is the difference between using the ampersand operator on an array and on a pointer?

asked 2023-06-05 20:20:59 +0000

woof gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2023-06-05 20:48:02 +0000

huitzilopochtli gravatar image

The ampersand operator on an array returns the address of the entire array, while the ampersand operator on a pointer returns the address of the variable pointed to by the pointer. In other words, when used on an array, the result is a pointer to the first element of the array, whereas when used on a pointer, the result is a pointer to the memory address where the value stored by the pointer resides.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2023-06-05 20:20:59 +0000

Seen: 1 times

Last updated: Jun 05 '23