Declaration and definition of pointer

I want to write a code to control a real time clock(RTC) IC. The RTC uses I2C communication and it act as a slave. my micro-controller is the host. I find a library from the web for doing the I2C communication.
The function for writing data is :
char I2C_Send(char Address,char *Data,char Num)


The (Address) is the I2C device address and it is fixed. The char pointer(*Data) is the input of the first data that will be send to the slave. The Num is the number of bytes that will be sent.

Firstly, I need to send a register address(reg_addr) to the RTC. So I write something like:

1: #define RTC_address 0xAC
2: const char reg_addr=0x08;
......
......
5: char *data_ptr=&reg_addr;
6: I2C_Send(RTC_address, data_ptr, 1);


However, the compiler said I have a syntax error in line 5.
Could you tell me what is the problem?
Thanks in advance!!
You cannot implicitly convert "const char *" to "char *".

This is a quite typical problem of C-based interfaces - they rarely use 'const'. Simply declare "reg_addr" as "char".
Topic archived. No new replies allowed.