I can see this has been asked countless times but I couldn't quite relate the answers I found my individual situation. I'm still getting the hang of C and haven't quite got my head around pointers yet. A basic version of the code I'm having issue with is below:
int function(unsigned long *timestamp)
{
timestamp = GetTick();
}
Where the GetTick() function returns a value of type uint32_t.
My problem then is that I get a compiler warning that the assignment makes a pointer from an integer without a cast. I understand that pointers and variables are different but I don't fully understand what the meaning of the warning is nor the right way to make the assignment? Any suggestions?
Edit: Might be worth mentioning that I didn't write this code myself, I'm simply trying to port it to use a new set of drivers that should allow it to do the same thing, in theory.
Update:
A cleaner version of the above code:
int function(unsigned long *timestamp)
{
if (timestamp)
timestamp = GetTick();
return 0;
}
uint32_tI agree, however. - too honest for this site-Wall -Wextra -Wconversionfor gcc) and compiler in C11 or at least C99 mode. - too honest for this site