received_data is a global char array of length 256. It contains a string at offset rx_pos_p i.e. received_data[rx_pos_p]. I want to return the address of this string through a pointer mem, but I think I am making a mistake. I have written the function as follows:
uint8_t get_bytes(char **mem, uint8_t len){// Be watchful pointer to a pointer
if(bytes_received() >= len){
mem = &received_data[rx_pos_p]; //(char *)( received_data + rx_pos_p );
return 0;
}
else
return FOO;
}
What should be the type of mem i.e. **mem or *mem ?