pointers - The meaning of "asterisk type asterisk" in C : *(volatile int *) foo -


i have tried looking around not able find answer this. found explaining when use double asterisk, **, however, not sure whether applied case.

i have come across embedded systems code looks bit foreign me :

port0 = *(volatile int *)(0x1c002100) 

what operation doing reads gpio port address 0x1c002100. deal asterisks ?

i have written :

port0 = *0x1c002100 

are doing type of pointer type casting , hence use 2 asterisks ? best guess. thank !

look @ expression, first convert integer constant pointer, deference pointer, yield integer. same as:

int *p = (volatile int *)(0x1c002100); int n = *p; port0 = n; 

the first * denotes pointer type, second dereference operator.

however second line invalid c code, since cannot dereference integer.

port0 = *0x1c002100; 

Comments

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -