#reference vs pointer parameter

19 messages · Page 1 of 1 (latest)

slow reef
#

What is the difference between passing in &X and *X to a function? *X is some pointer to a variable and &X also means somewhat the same thing since it’s a “reference” right?

shut craterBOT
#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.

spice tundra
#

Also please properly format your question

#

Right now a few * are interpreted as formatting characters leading to stuff like this:

slow reef
#

Is this not a thing in C?

spice tundra
#

references? No, they're not a thing in C

#

ah wait!

spice tundra
slow reef
#

Ohhh

#

Yes sorry

#

I didn’t know they weren’t a thing in C

rugged shell
#

So in a nutshell, a pointer points to the first byte instead of the entire amount of bytes?

And a &value would refer to the memory location?

#

And this is why referring changes the value of the location?

spice tundra
#

References aren't a thing in C, the question itself didn't make sense to begin with.
No clue what that comment of yours is supposed to mean

rugged shell
#

Sorry I have returned back to monke, rejected humanity.

#

I think I have an issue with terminology here