C

Asked • 05/19/19

Pointers in C: when to use the ampersand and the asterisk?

I'm just starting out with pointers, and I'm slightly confused. I know `&` means the address of a variable and that `*` can be used in front of a pointer variable to get the value of the object that is pointed to by the pointer. But things work differently when you're working with arrays, strings or when you're calling functions with a pointer copy of a variable. It's difficult to see a pattern of logic inside all of this.When should I use `&` and `*`?

1 Expert Answer

By:

Patrick B. answered • 05/20/19

Tutor
4.7 (31)

Math and computer tutor/teacher

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.