Skip to content

Comment on Ask HN: In C, why is the * operator both reference and type casting?

Comments

(Mentally replace all ^s with asterisks in the following:)

I don't understand your C code. What is "(int foo^)" supposed to do? It looks almost like a cast, but "int foo" isn't a valid type in C. Maybe "(struct foo^)" or "(int^)"?

I wrote that wrong, my bad. I was copying from a call-by-value example from memory. Changed the following:

  *(int *foo)pointer_param /*changed to*/  *(int*)pointer_param = bar
AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.