Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] how to access volatile char array through non volatile char pointer

Status
Not open for further replies.

scorrpeio

Full Member level 5
Joined
Dec 26, 2006
Messages
286
Helped
10
Reputation
20
Reaction score
9
Trophy points
1,298
Activity points
3,496
I have a function whose argument consist of a pointer to unsigned char.

Now, I want to pass an array of type volatile unsigned char. :!:

If I try to pass it directly, compiler doesn't allow me to do so. I think it needs typecasting to be done but I am not sure if it works. :sad:

I am searching about it on the google as well.

Can anyone here tell me what can be the probable way to do this?
 

assuming you have
Code:
volatile unsigned char x[10]={'Z'};
and a function
Code:
void test(unsigned char *ch)
you can try
Code:
    test((unsigned char *) x);
 
That is working.

I initially tried it in reverse way by which, normal pointer was casted to volatile pointer. that is why I did get an error
 

Last edited:
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top