I have written a function and asked some questions here about it. It works very well, I can call it and use it. But something has confused my mind. Here is the function prototype which I just mentioned:
void writeToEEPROM( uint8 srcBuf[], uint32 byteCount, int writePtr);
I can call this function by sending my array to it, like this:
uint8 mysrcBuf[10];
writeToEEPROM(mysrcBuf,10,0); // This is working.
In the function prototype, it gets *srcBuff
and ,as I know, *srcBuff
is the value in the address of srcBuff
. I mean, asteriks(*
) operand actually reads the value of that address, doesn't it? But I am sending mysrcBuf
which is the address for the first element of the array.
If i declare the function like below, it still works:
void writeToEEPROM( uint8 * srcBuf, uint32 byteCount, int writePtr);
Are these statements same?:
uint8 srcBuf[]
and uint8 * srcBuf
It does not warn me or cause problems if I change the declaration and call it with same way.
(Sorry if there is a duplicate of this question. I have searched pointers a lot. But it still confuses me sometimes.)