Guest
|
Pointer to const string problem |
Posted: Mon Oct 20, 2008 1:51 am |
|
|
Hi to all.
I am trying to set up a pointer to a constant string , but it won't compile. I did it as shown in the documentation , but no luck.
Any ideas what I'm doing wrong.
Here is the code. The uncommented code works fine(strings stored in RAM) ,
but if I try and store them in ROM (commented out code) it won't compile.
Cheers
Rob
Code: |
#use delay(clock=16000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7 , bits=8, parity=N ,errors)
#fuses HS,NOWDT,NOPROTECT,NOPUT,BROWNOUT,NOLVP
#include <stdio.h>
#include <string.h>
char message1[]={"Some text"};
char message2[]={"Some other text"};
char *ptr1;
/*
const char message1[14]={"Some text"};
const char message2[15]={"Some other text"};
const char *ptr1;
*/
//---------------------------------------------------------MAIN---------------------------------------------------------------------
void main (void)
{
}
|
|
|