Pass a pointer to a function as read-only in C

c, function, pointers, readonly

Solution

I have to be sure the function doesn't edit the contents

Unless the function takes a `const` parameter, the only thing you can do is explicitly pass it a copy of your data, perhaps created using `memcpy`.

Problem

Just as the title says, can I pass a pointer to a function so it's only a copy of the pointer's contents? I have to be sure the function doesn't edit the contents. Thank you very much.

Original source