I have a struct, and I have been passed a pointer to it to the function I'm in, how do I then use this pointer to access stuff in the struct?
Thanks
I have a struct, and I have been passed a pointer to it to the function I'm in, how do I then use this pointer to access stuff in the struct?
Thanks
I'm not sure what you're saying, post some source code.
do you mean with the "->" operator?
fooptr->member
Is the pointer equivalent of
foo.member
You can also do
(*fooptr).member or fooptr[0].member if you want, though the latter is preferred if you really do have a pointer to an array of structures.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.