Hi, in C is there a way I can write a function that returns a pointer to data, in a way that ensures that the calling function can't modify the data that the pointer points to?
For example, I have a module A that acquires data, and another module B that needs to use that data. I'd like to write a function in A like this
that returns a pointer to an array of acquired data, and a function in module B calls this function, receives the array, and can use the data.
However, I don't want module B to be able to modify the data; only A should be modifying the data, for module B it is read-only. Is there a way to provide a pointer that somehow disallows that? I don't think a const pointer will do it, right? This probably just keeps the address constant. Any other way to do this?
Thanks very much in advance.