hello188
Joined: 02 Jun 2010 Posts: 74
|
Pointer Operator |
Posted: Tue Apr 30, 2013 4:58 pm |
|
|
Hi I am trying to convert a firmware written for 8051 with keil C compiler to PIC source code for CCS compiler
here, it seems to use pointer operation
A->B = 0x0000
what does it mean? above expression seems to compile without problem
However,
D->E |=D
doesn't pass the compiler test
How do you break it up into two so that it compiles?
Thank you |
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue Apr 30, 2013 5:25 pm |
|
|
Quote: | D->E |=D
doesn't pass the compiler test
|
It would be better if you posted the actual line of code and all the data
declarations for it. Or better, post a test program and your compiler
version. Example:
Code: |
#include <18F4520.h>
#fuses INTRC_IO, NOWDT, PUT
#use delay(clock=4M)
#use rs232(baud=9600, UART1, ERRORS)
typedef struct
{
int8 a;
int8 b;
int8 c;
}abc_t;
abc_t my_struct = {0,1,2};
void func1(abc_t *s_ptr)
{
s_ptr->a |= 0x55;
}
//============================
void main()
{
printf("%x ", my_struct.a);
func1(&my_struct);
printf("%x ", my_struct.a);
while(1);
} |
|
|