Structure Initialization

Hi All,

I am writing a code where in I have used nested structure. All these structures are defined to be a 64 bit register. Trying to assign a value to these structures as a whole but it is not happening properly. The problem is whole value is not getting assigned. Only a part of it is getting assigned. I have pasted the code here. Please let me know how can I fix it. Thank you in advance.
[size=3]Header file:
struct SARx
unsigned long SAR;
struct CHNL_reg
struct SARx sar;
struct dma_reg
struct CHNL_reg ch_reg;

C File:
struct dma_reg rst_val;
unsigned long *ptr;
ptr = (unsigned long) &(rst_val.ch_reg.sar);
*ptr=(unsigned long)0x0ffffaaaaabc;
printf(" %x
", (rst_val.ch_reg.sar));
END CODE.[/size]

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!