Ok so I have this code and was wondering if anybody could confirm that I have the pointers (* and &) in the right places. Heres the general jist of it
int main() {
message_t msg; //this is a structure
write(&msg);
}
write(message_t *msg) {
putBuffer(msg);
}
I really am confused by this pointer business, way too used to working in java.
Thanks!
Yeah, that works, as long as you have the prototype to the write function somewhere about int main().
About your confusion with pointers, these tutorials here will help you. He gets into pointers and references at tutorial 38. I learned about how pointers and stuff works through these tutorials, I would suggest them they’ll help clear things up. The tutorials may be about c++, but most of the stuff he goes through will work just as fine in C, and anything that doesn’t should be easy to get working in C.