Hi Folks
Pointers in C is something I always end up confusing myself with...
I have a function that is passed a pointer to a handle. this function should then pass that pointer on to a sub-function.
My confusion is where I call the sub-function txSerial().Code:int txSerial (HANDLE *hComm) { // Do some stuff using *hComm here. // EG. if (*hComm == INVALID_HANDLE_VALUE) { printf("Comm port returned an invalid handle\n"); return 1; } return 0; } int txSPI (HANDLE *hComm) { return (txSerial(hComm)); //<<--- CONFUSED HERE. } int main (void) { HANDLE hComm1; int x; // Assign a handle to hComm1. x = txSPI(&hComm1); return x; }
Should I be passing *hComm or hComm ???
Got my thinking all knotted up here, help much appreciated, Thanks




Reply With Quote