New ask Hacker News story: Ask HN: In C, how to map void* to int propertly

Ask HN: In C, how to map void* to int propertly
2 by amir734jj | 4 comments on Hacker News.
Quick question. If we have `void ` how can we translate it to `int`. For example this: `static void dfs(SccGraph graph, LinkedStack* stack, bool* visited, void* v)` I need to mark `v` as visited but how can I quickly convert `void ` to `int` so I can mark `visited[(int) v] = true` I can convert `void ` to `int` with a cast but then I need to make sure the size of the `visited` array is prime and not any `n`. Not sure what is the right way to do this.

Comments