Wond3rboy
Member
Code:
#include<p18f1320.h>
char * data=00;// Initiazlizes it to zero so the array is saved on
// first location and one can retrieve it.
void main(void)
{
rom near char * pname;
static rom near char name[]="Hi";
pname=name;//pointer points to first element of name
*data++=*pname++;
*data ++=*pname++;
[B]data=data+20;;
pname=name;
*data++=*pname++;
*data ++=*pname++;
while(1);
}[/B]
//void main(void)
//{
////static rom near char name[]="Hi";
//*data++=name[];
//*data ++=pname[];
//while(1);
//}
Hi I was doing little code examples and creating a little pointer flash card like thing for my self in the process.The code in the comments works fine.As you can see that one can initialize a pointer at a specific location but what the problem is that cant seem to reinitialize it with the statement:
data=0x20;
It says wrong assignment.But the addition thing works fine.
I want to first store it from ram location 00 and then be able to access it using the pointer.Also & is illegal in C18.
Last edited: