I need help to grasp something. Currently I am testing the code on microcontroller platform with small amount of memory (ROM(FLASH), RAM). This is the code
void print(const char * c)
{
printf("%#4x, ",c);
printf("%s\n",c);
}
This is the function call
print("Riko");
And the output is: 0x5C4C, Riko
The memory address 0x5C4C resides in FLASH (MAIN CODE MEMORY) so the literal string "Riko"
must also reside in that memory segment? My question is: When we pass "Riko"
as argument to the function print
, does it actually mean that we pass the address of the first character of the string "Riko"
or ((const char*) 0x5C4C)
as argument to the function print
? Thanks a lot...